package com.acce.core.controller;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import nl.justobjects.pushlet.core.Dispatcher;
import nl.justobjects.pushlet.core.Event;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.acce.core.config.CarParkArea;
import com.acce.core.config.ReturnCodes;
import com.acce.core.pojo.ArgsPojo;
import com.acce.core.pojo.CarPack;
import com.acce.core.pojo.ChargesManagement;
import com.acce.core.pojo.ColdStorage;
import com.acce.core.pojo.CompanyDepartment;
import com.acce.core.pojo.CompanyList;
import com.acce.core.pojo.EmployeeInfo;
import com.acce.core.pojo.FeeCount;
import com.acce.core.pojo.FeeReportBody;
import com.acce.core.pojo.Goods;
import com.acce.core.pojo.InquiryHeader;
import com.acce.core.pojo.InquiryList;
import com.acce.core.pojo.LeasingContract;
import com.acce.core.pojo.MarketStore;
import com.acce.core.pojo.MarketStoreProp;
import com.acce.core.pojo.PurchaseHeader;
import com.acce.core.pojo.PurchaseList;
import com.acce.core.pojo.QuoteHeader;
import com.acce.core.pojo.QuoteList;
import com.acce.core.pojo.ReturnPojo;
import com.acce.core.pojo.UserList;
import com.acce.core.utils.Constants;
import com.acce.core.utils.EncodingTool;
import com.acce.core.utils.PropertiesUtil;
import com.acce.core.utils.TokenUtils;
import com.acce.core.utils.Utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;

@Controller
public class CenterController extends BaseController{

	Logger logger = Logger.getLogger(CenterController.class);
	String preModular = "wape-web";
	String authPath = PropertiesUtil.getInstance().getProperties("/system.properties").getProperty("authPath");
	String productPath = PropertiesUtil.getInstance().getProperties("/system.properties").getProperty("productPath");
	String marketPath = PropertiesUtil.getInstance().getProperties("/system.properties").getProperty("marketPath");
	String wapeWechatAppID = PropertiesUtil.getInstance().getProperties("/system.properties").getProperty("wapeWechatAppID");
	String wapeWechatAppSecret = PropertiesUtil.getInstance().getProperties("/system.properties").getProperty("wapeWechatAppSecret");

	@RequestMapping("/api/core/centerService")
	public void center(@ModelAttribute("argsPojo")ArgsPojo args,HttpServletRequest request, HttpServletResponse response, HttpSession httpSession){
		String serviceCode=args.getServiceCode();
		if(serviceCode.equals("1001W01")){
			getWXOpenId(args,response,request);
		}else if(serviceCode.equals("1001W02")){
	    	autoLoginWX(args,response,request,httpSession);
	    }else if(serviceCode.equals("1001W05")){
	    	sendSMSCode(args,response,request,httpSession);
	    }else if(serviceCode.equals("5001U01")){
	    	checkNumRepeat(args,request,response,httpSession);
	    }else if(serviceCode.equals("5001U02")){
	    	registerUser(args,request,response,httpSession);
	    }else if(serviceCode.equals("5002U01")){
	    	login(args,response,request,httpSession);
	    }else if(serviceCode.equals("5002U02")){
	    	logout(args,response,request,httpSession);
	    }else if(serviceCode.equals("5001U11")){
	    	checkCompanyRepeat(args,request,response,httpSession);
	    }else if(serviceCode.equals("5001U12")){
	    	registerCompany(args,request,response,httpSession);
	    }else if(serviceCode.equals("5003U01")){
	    	queryUserInfo(args,response,request,httpSession);
	    }else if("5003U02".equals(serviceCode)){
			resetUserInfo(args,response,request,httpSession);  //重置个人信息
		}else if("5003U12".equals(serviceCode)){
			resetCompanyInfo(args,response,request,httpSession);  //重置公司信息
		}else if("5004U01".equals(serviceCode)){
			resetPwd(args,response,request,httpSession);  //重置公司信息
		}else if("5004U02".equals(serviceCode)){
			findPwd(args,response,request,httpSession);  //重置公司信息
		}else if("5006U04".equals(serviceCode)){
			queryVagueCompany(args,response,request,httpSession);  //模糊查询公司
		}else if("5006U05".equals(serviceCode)){
			queryVagueCompanyToPage(args,response,request,httpSession);  //模糊查询公司
		}else if("5006U08".equals(serviceCode)){
			exitCompany(args,response,request,httpSession);  //离开公司
		}else if("5006U13".equals(serviceCode)){
			queryJoinCompanyInfo(args,response,request,httpSession);  //模糊查询公司
		}else if("5006U14".equals(serviceCode)){
			queryJoinCompanyDepart(args,response,request,httpSession);  //模糊查询公司
		}else if(serviceCode.equals("3002P02")){
	    	queryParchaseHeader(args,response,request,httpSession);
	    }else if(serviceCode.equals("3002P03")){
	    	queryParchaseDetail(args,response,request,httpSession);
	    }else if(serviceCode.equals("3004P03")){
	    	queryInquiryHeader(args,response,request,httpSession);
	    }else if(serviceCode.equals("3004P04")){
	    	queryInquiryDetail(args,response,request,httpSession);
	    }else if(serviceCode.equals("3005P04")){
	    	queryQuoteHeader(args,response,request,httpSession);
	    }else if(serviceCode.equals("3005P05")){
	    	queryQuoteDetail(args,response,request,httpSession);
	    }else if(serviceCode.equals("3000P01")){
	    	queryProductYX(args,response,request,httpSession);
	    }else if(serviceCode.equals("3000P02")){
	    	addProductYX(args,response,request,httpSession);
	    }else if(serviceCode.equals("3000P03")){
	    	deleteProductYX(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS108")){
	    	queryShed(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS110")){
	    	queryInRecord(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS111")){
	    	insertInRecord(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS112")){
	    	queryFeeRecord(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS113")){
	    	insertOutRecord(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS120")){
	    	queryWaitPayRecord(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS121")){
	    	insertChargeRecord(args,response,request,httpSession);
	    }else if("MMZS122".equals(serviceCode)){
			query24HourPayRecord(args, response,request,httpSession);  //查询24小时内费用列表
		}else if("MMZS123".equals(serviceCode)){//生成缴费报告
			generate24HourPayReport(args, response,request,httpSession);
		}else if("MMZS124".equals(serviceCode)){//查询缴费报告
			query24HourPayReport(args, response,request,httpSession);
		}else if("MMZS125".equals(serviceCode)){//查询编辑列表
			queryEditRecord(args, response,request,httpSession);
		}else if("MMZS126".equals(serviceCode)){//查询编辑列表
			querySingleEditRecord(args, response,request,httpSession);
		}else if("MMZS127".equals(serviceCode)){//查询编辑列表
			editSingleRecord(args, response,request,httpSession);
		}else if("MMZS128".equals(serviceCode)){//查询编辑列表
			removeRecord(args, response,request,httpSession);
		}else if("MMZS129".equals(serviceCode)){//按时间查看费用报告
			queryReportListByTime(args, response,request,httpSession);
		}else if("MMZS130".equals(serviceCode)){//按费用类型查看费用报告
			queryReportListByType(args, response,request,httpSession);
		}else if("MMZS138".equals(serviceCode)){//按费用类型查看费用报告明细
			queryReportDetailByType(args, response,request,httpSession);
		}else if(serviceCode.equals("MMZS201")){//点击换车位按钮, 对车位进行锁定
	    	lockCar(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS202")){//设置新的车
	    	chooseCar(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS203")){//显示更换车位信息
			compareCar(args,response,request,httpSession);
		}else if(serviceCode.equals("MMZS204")){//进行换车位信息
			changeCar(args,response,request,httpSession);
		}else if(serviceCode.equals("MMZS205")){
	    	queryFeeRecordForPrint(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS131")){ 
	    	joinCompanyOne(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS132")){
	    	employeeManage(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS133")){
	    	joinAuditPass(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS134")){
	    	joinCompanyFinal(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS140")){
	    	toUserInfo(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS141")){
	    	getCompanyDepart(args,response,request,httpSession);
	    }else if(serviceCode.equals("WJ9999")){
	    	transferTarget(args,response,request,httpSession);
	    }else if(serviceCode.equals("CS8888")){
	    	laqu(args,response,request);
	    }
		//区域与商铺
	    else if(serviceCode.equals("MMZS21101")){
	    	insertTopMarket(args,response,request,httpSession); //添加一级区域
	    }else if(serviceCode.equals("MMZS21102")){
	    	toOperMarket(args,response,request,httpSession); 
	    }else if(serviceCode.equals("MMZS21103")){
	    	queryMarketDetail(args,response,request,httpSession);  //查询二级区域明细
	    }else if(serviceCode.equals("MMZS21105")){
	    	insertMarketOtherInfo(args,response,request,httpSession); //添加二级区域其他信息
	    }else if(serviceCode.equals("MMZS21106")){
	    	updateMarketOtherInfo(args,response,request,httpSession); //修改二级区域其他信息
	    }else if(serviceCode.equals("MMZS21108")){
	    	toOutlineAllMarket(args,response,request,httpSession); //
	    }else if(serviceCode.equals("MMZS21109")){
	    	insertSecondMarket(args,response,request,httpSession); // 添加二级区域
	    }else if(serviceCode.equals("MMZS21201")){
	    	toStoreListNotState(args,response,request,httpSession); //档口分布列表，仅查看，无状态
	    }else if(serviceCode.equals("MMZS21202")){
	    	insertStore(args,response,request,httpSession); //添加商铺
	    }else if(serviceCode.equals("MMZS21203")){
	    	queryStoreBrief(args,response,request,httpSession); //
	    }else if(serviceCode.equals("MMZS21204")){
	    	queryStoreDetailAndSub(args,response,request,httpSession); //查询商铺设施信息
	    }else if(serviceCode.equals("MMZS21205")){
	    	queryStoreDetailAndArea(args,response,request,httpSession); //查询商铺面积信息
	    }else if(serviceCode.equals("MMZS21206")){
	    	updateStoreDetail(args,response,request,httpSession); //修改商铺详细信息
	    }else if(serviceCode.equals("MMZS21207")){
	    	insertStoreAreaInfo(args,response,request,httpSession); //添加商铺面积信息
	    }else if(serviceCode.equals("MMZS21208")){
	    	updateStoreAreaInfo(args,response,request,httpSession); //修改商铺面积信息
	    }else if(serviceCode.equals("MMZS21209")){
	    	touOperSubInfo(args,response,request,httpSession);
	    }else if(serviceCode.equals("MMZS21210")){
	    	insertStoreSubInfo(args,response,request,httpSession); //添加商铺设施信息
	    }else if(serviceCode.equals("MMZS21211")){
	    	toStoreList(args,response,request,httpSession); //档口出租商铺分布，显示状态
	    }else if(serviceCode.equals("MMZS21212")){
	    	toStoreListByRental(args,response,request,httpSession); //档口出租商铺分布，显示状态,租金
	    }
		//冷库
	    else if(serviceCode.equals("MMZS23101")){
	    	queryGoodsInColdStorage(args,response,request,httpSession);
	    }
		//
	    else if(serviceCode.equals("MMZS24101")){
	    	insertLeasingContract(args,response,request,httpSession); //合同录入
	    }else if(serviceCode.equals("MMZS24102")){
	    	payDeposit(args,response,request,httpSession);  //定金缴纳
	    }else if(serviceCode.equals("MMZS24103")){
	    	queryLeasingContractByStore(args,response,request,httpSession); //查询商铺合同签约情况(缴定金)
	    }else if(serviceCode.equals("MMZS24104")){
	    	collectLeasingContractFromStore(args,response,request,httpSession); //查询商铺总体合同情况(商铺维度)
	    }else if(serviceCode.equals("MMZS24105")){
	    	collectLeasingContractFromTime(args,response,request,httpSession); //查询商铺总体合同情况(时间维度)
	    }else if(serviceCode.equals("MMZS24106")){
	    	collectDepositFromStore(args,response,request,httpSession); //查询商铺总体定金缴费情况(商铺维度)
	    }else if(serviceCode.equals("MMZS24107")){
	    	collectDepositFromTime(args,response,request,httpSession); //查询商铺总体定金缴费情况(时间维度)
	    }else if(serviceCode.equals("MMZS24108")){
	    	queryLeasingContractByLeasing(args,response,request,httpSession); //查询合同签约明细(合同)
	    }else if(serviceCode.equals("MMZS24109")){
	    	queryLeasingContractByDeposit(args,response,request,httpSession); //查询合同签约明细(定金)
	    }else if(serviceCode.equals("MMZS24110")){
	    	queryLeasingContractByStoreRent(args,response,request,httpSession); //查询商铺合同签约情况(缴租金)
	    }else if(serviceCode.equals("MMZS24111")){
	    	payRental(args,response,request,httpSession);  //租金缴纳
	    }else if(serviceCode.equals("MMZS24112")){
	    	collectRentalFromStore(args,response,request,httpSession); //查询商铺总体本月租金缴费情况(商铺维度)
	    }
//	    else if(serviceCode.equals("MMZS24105")){
//	    	toStoreListNotState(args,response,request,httpSession); //
//	    }
		
//	    else if(serviceCode.equals("8888")){
//	    	login(args,response,request,httpSession);
//	    }
	   
	} 
	
	/**
	 * 手机号查重
	 * @param args
	 * @param response
	 */
	private void checkNumRepeat(ArgsPojo args,HttpServletRequest request, HttpServletResponse response,HttpSession httpSession ){
		String locMeth = "checkNumRepeat";
		JSONObject json = new JSONObject();
		String registerNum = args.getRegisterNum();
		String isWX = args.getIsWX();
		String openId = args.getOpenId();
		json.put("registerNum", registerNum);
	    json.put("registerType", "p");
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
		logger.info("web is args:" + buff.toString());
		String serviceToken="411e7bc272a421b44802a9f608a740e5ca74872a";
		String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = registerNum;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "browser";
	    String mac = "00-00-00-00-00-00";
	    String business = buff.toString();
		
	    String serviceAddr = authPath;
	    Map<String, String> ckformparams = new HashMap<String, String>();
		ckformparams.put("serviceCode", serviceCode);
		ckformparams.put("sign", sign);
		ckformparams.put("timestamp", timestamp);
		ckformparams.put("nonce", nonce);
		ckformparams.put("editUserId", editUserId);
		ckformparams.put("editTime", editTime);
		ckformparams.put("ipaddr", ipaddr);
		ckformparams.put("device", device);
		ckformparams.put("mac", mac);
		ckformparams.put("business", business);
		logger.info(preModular + "::" + locMeth + "::check num repeat business::" + business);
		String serviceString = sendhttp(serviceAddr, ckformparams);
		logger.info(preModular + "::" + locMeth + "::check num repeat return::" + serviceString);
		
        JSONObject serviceJson=JSON.parseObject(serviceString);
        String returnCode = serviceJson.getString("returnCode");
        String remsg = serviceJson.getString("returnMsg");
        logger.info("wape-web::checkNumRepeat::isWX" + isWX);
        logger.info("wape-web::checkNumRepeat::openId" + openId);
        if("200".equals(returnCode)){
        	request.setAttribute("registerNum", registerNum);
        	logger.info("registerNum into request:"+request.getAttribute("registerNum"));
        	try {
        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
        		request.setAttribute("reopenId", openId);
        		request.getRequestDispatcher("/we/w-registered-2.jsp?openId=" + openId).forward(request, response);	
        		}else{
        			request.getRequestDispatcher("/3g/registered-2.jsp").forward(request, response);
        		}
			} catch (Exception e) {
				e.printStackTrace();
			}
        }else{
        	request.setAttribute("remsg", remsg);
        	try {
        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
        			request.getRequestDispatcher("https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx167b18378241425a&redirect_uri=" 
        		+ Constants.WEB_SERVICE_ADDR + "/we/w-registered.jsp?remsg=" + remsg 
        		+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect").forward(request, response);
        		}else{
        			request.getRequestDispatcher("/3g/registered.jsp").forward(request, response);
        		}
			} catch (Exception e) {
				e.printStackTrace();
			}
        }
	}
	/**
	 * 登录,登录后保存用户信息(包括所属公司)，公司信息
	 * @param args
	 * @param response
	 */
	private void login(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String locMeth = "login";
		String registerNum = args.getRegisterNum();
		String pwd = args.getPwd();
		String isWX = args.getIsWX();
		String openId = args.getOpenId();
		request.setAttribute("isWX", isWX);
		request.setAttribute("openId", openId);
		if(!StringUtils.isEmpty(openId)){
			openId = openId.replaceAll("\\n", "").replaceAll("\\r", "");
		}
		logger.info(preModular + "::" + locMeth + ":: registerNum::" + registerNum);
		logger.info(preModular + "::" + locMeth + ":: isWX::" + isWX);
		logger.info(preModular + "::" + locMeth + ":: openId::" + openId);
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error(preModular + "::" + locMeth + "::ip not get::" + e2.getMessage());
		}
		String device;
		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
			device = "wx";
		}else{
			device = "pc";
		}
	    String mac = "00-00-00-00-000";
		//openId查重
	    if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
	    	logger.info(preModular + "::" + locMeth + ":: start check openId::" + openId);
	    	String token1="411e7bc272a421b44802a9f608a740e5ca74872a";
			String timestamp1 = Utils.getCurrTimeMillions();
		    String nonce1 = Utils.getNonce();
		    String sign1 = "";
			try {
				sign1 = TokenUtils.getSign(token1, timestamp1, nonce1);
			} catch (NoSuchAlgorithmException e3) {
				logger.error(preModular + "::" + locMeth + ":: sign1 make error::" + e3.getMessage());
			}
		    String editUserId1 = registerNum;
		    String editTime1 = timestamp1;
	    	JSONObject businessJson1 = new JSONObject();
	    	businessJson1.put("openId", openId);
	    	businessJson1.put("registerNum", registerNum);
			String business1 = businessJson1.toJSONString();
			Map<String, String> params1 = new HashMap<String, String>();
			params1.put("serviceCode", "1001W03");
			params1.put("sign", sign1);
			params1.put("timestamp", timestamp1);
			params1.put("nonce", nonce1);
			params1.put("editUserId", editUserId1);
			params1.put("editTime", editTime1);
			params1.put("ipaddr", ipaddr);
			params1.put("device", device);
			params1.put("mac", mac);
			params1.put("business", business1);
			logger.info(preModular + "::" + locMeth + "::check openId business1::" + business1);
			String resultString1 = sendhttp(authPath, params1);
			logger.info(preModular + "::" + locMeth + "::check openId resultString1::" + resultString1);
			JSONObject resultObj1 = JSON.parseObject(resultString1);
			String returnCode1 = resultObj1.getString("returnCode");
			String returnMsg1 = resultObj1.getString("returnMsg");
			request.setAttribute("returnCode", returnCode1);
			request.setAttribute("returnMsg", returnMsg1);
			logger.info(preModular + "::" + locMeth + "::check openId returnCode1::" + returnCode1);
			logger.info(preModular + "::" + locMeth + "::check openId returnMsg1::" + returnMsg1);
			if(!"200".equals(returnCode1)){ //openId已存在，验证失败，跳转至登录页面，
	        	try {
	        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
//	        			String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid= " + wapeWechatAppID + "&redirect_uri=" 
//	    	        			+ Constants.WEB_SERVICE_ADDR + "/we/w-login.jsp?returnMsg=" + returnMsg1 + "&returnCode=" + returnCode1
//	    	        			+ "&openId=" + openId + "&isWX=" + isWX
//	    	        			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
	        			String url = "/we/w-login.jsp";
	        			logger.error(preModular + "::" + locMeth + "::send::" + url);
	        			request.getRequestDispatcher(url).forward(request, response);
	        			return;
//	        			response.sendRedirect(url);
	        		}else{
	        			logger.error(preModular + "::" + locMeth + "::send::login.jsp");
	        			request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
	        			return;
	        		}
				} catch (Exception e) {
					logger.error(preModular + "::" + locMeth + "::send error::" + e.getMessage());
				}
			}
	    }
	    logger.info(preModular + "::" + locMeth + "::start login");
		//登录
	    String token2="411e7bc272a421b44802a9f608a740e5ca74872a";
		String timestamp2 = Utils.getCurrTimeMillions();
	    String nonce2 = Utils.getNonce();
	    String sign2 = "";
		try {
			sign2 = TokenUtils.getSign(token2, timestamp2, nonce2);
		} catch (NoSuchAlgorithmException e3) {
			logger.error(preModular + "::" + locMeth + ":: sign2 make error::" + e3.getMessage());
		}
	    String editUserId2 = registerNum;
	    String editTime2 = timestamp2;
		JSONObject businessJson2 = new JSONObject();
		businessJson2.put("registerNum", registerNum);
		businessJson2.put("registerType", "p");
		businessJson2.put("pwd", pwd);
		businessJson2.put("isWX", isWX);
		businessJson2.put("openId", openId);
	    String business2 = businessJson2.toJSONString();
	    Map<String, String> params2 = new HashMap<String, String>();
	    params2.put("serviceCode", "5002U01");
	    params2.put("sign", sign2);
	    params2.put("timestamp", timestamp2);
	    params2.put("nonce", nonce2);
	    params2.put("editUserId", editUserId2);
	    params2.put("editTime", editTime2);
	    params2.put("ipaddr", ipaddr);
	    params2.put("device", device);
	    params2.put("mac", mac);
	    params2.put("business", business2);
	    logger.info(preModular + "::" + locMeth + "::login business2::" + business2);
		String resultString2 = sendhttp(authPath, params2);
		 logger.info(preModular + "::" + locMeth + "::resultString2::" + resultString2);
		JSONObject resultJson2=JSON.parseObject(resultString2);
        String resultObject2=resultJson2.getString("result");
        String returnCode2 = resultJson2.getString("returnCode");
        String returnMsg2 = resultJson2.getString("returnMsg");
        request.setAttribute("returnCode", returnCode2);
		request.setAttribute("returnMsg", returnMsg2);
		logger.info(preModular + "::" + locMeth + "::login returnCode2::" + returnCode2);
		logger.info(preModular + "::" + locMeth + "::login returnMsg2::" + returnMsg2);
        JSONObject resultData2 = JSON.parseObject(resultObject2);
        if("200".equals(returnCode2)){
    		String atUserId = resultData2.getString("atUserId");
    		String token3 = resultData2.getString("token");
    		httpSession.setAttribute("atUserId", atUserId);
        	httpSession.setAttribute("token", token3);
        	httpSession.setAttribute("openId", openId);
    		String timestamp3 = Utils.getCurrTimeMillions();
    	    String nonce3 = Utils.getNonce();
    	    String sign3 = "";
    		try {
    			sign3 = TokenUtils.getSign(token3, timestamp3, nonce3);
    		} catch (NoSuchAlgorithmException e3) {
    			logger.error(preModular + "::" + locMeth + ":: sign3 make error::" + e3.getMessage());
    		}
    	    String editUserId3 = atUserId;
    	    String editTime3 = timestamp3;
        	//当登录成功后查询个人信息
    		JSONObject businessJson3 = new JSONObject();
    		businessJson3.put("atUserId", atUserId);
    		businessJson3.put("token", token3);
    	    String business3 = businessJson3.toJSONString();
    	    Map<String, String> params3 = new HashMap<String, String>();
    	    params3.put("serviceCode", "5003U01");
    	    params3.put("sign", sign3);
    	    params3.put("timestamp", timestamp3);
    	    params3.put("nonce", nonce3);
    	    params3.put("editUserId", editUserId3);
    	    params3.put("editTime", editTime3);
    	    params3.put("ipaddr", ipaddr);
    	    params3.put("device", device);
    	    params3.put("mac", mac);
    	    params3.put("business", business3);
    	    logger.info(preModular + "::" + locMeth + "::business3::" + business3);
    		String resultString3 = sendhttp(authPath, params3);
    		logger.info(preModular + "::" + locMeth + "::resultString3::" + resultString3);
    		JSONObject resultObject3 = JSON.parseObject(resultString3);
    		String returnCode3 = resultObject3.getString("returnCode");
    		String returnMsg3 = resultObject3.getString("returnMsg");
    		logger.info(preModular + "::" + locMeth + "::query user info returnCode3::" + returnCode3);
    		logger.info(preModular + "::" + locMeth + "::query user info returnMsg3::" + returnMsg3);
    		request.setAttribute("returnCode", returnCode3);
    		request.setAttribute("returnMsg", returnMsg3);
    		if("200".equals(returnCode3)){
    			JSONObject resultData3 = JSON.parseObject(resultObject3.getString("result"));
                UserList user = JSONObject.toJavaObject(resultData3, UserList.class);
                httpSession.setAttribute("user", user);
                try {
    				if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
            			String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wapeWechatAppID + "&redirect_uri=" 
                    			+ Constants.WEB_SERVICE_ADDR + "/3g/mine/mine.jsp?returnCode=" + returnCode3 
                    			+ "&returnMsg=" + returnMsg3 + "&openId=" + openId + "&isWX=" + isWX
                    			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
//            			String url = "/3g/company/company.jsp";
            			logger.info(preModular + "::" + locMeth + "::send::" + url);
//            			request.getRequestDispatcher(url).forward(request, response);
            			response.sendRedirect(url);
            			return;
            		}else{
            			logger.info(preModular + "::" + locMeth + "::index.jsp");
            			request.getRequestDispatcher("/index.jsp").forward(request, response);
            			return;
            		}
				} catch (Exception e) {
					e.printStackTrace();
				}
    		}else{ //返回登录页面
    			try {
    				if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
//    					String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wapeWechatAppID + "&redirect_uri=" 
//    	            			+ Constants.WEB_SERVICE_ADDR + "/we/w-login.jsp?returnCode=" + returnCode3 + "&returnMsg=" + returnMsg3
//    	            			+ "&openId=" + openId + "&isWX=" + isWX
//    	            			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
    					String url = "/we/w-login.jsp";
            			logger.info(preModular + "::" + locMeth + "::send::" + url);
            			request.getRequestDispatcher(url).forward(request, response);
            			return;
//            			response.sendRedirect(url);
            		}else{
            			logger.info(preModular + "::" + locMeth + "::index.jsp");
            			request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
            			return;
            		}
				} catch (Exception e) {
					logger.error(preModular + "::" + locMeth + "::send error::" + e.getMessage());
				}
    		}
    	}else{ //登录失败
    		try {
        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
//        			String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wapeWechatAppID + "&redirect_uri=" 
//                			+ Constants.WEB_SERVICE_ADDR + "/we/w-login.jsp?returnCode=" + returnCode2 + "&returnMsg=" + returnMsg2
//                			+ "&openId=" + openId + "&isWX=" + isWX
//                			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
        			String url = "/we/w-login.jsp";
        			logger.info(preModular + "::" + locMeth + "::send::" + url);
        			request.getRequestDispatcher(url).forward(request, response);
        			return;
//        			response.sendRedirect(url);
        		}else{
        			logger.info(preModular + "::" + locMeth + "::index.jsp");
        			request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
        			return;
        		}
			} catch (Exception e) {
				logger.error(preModular + "::" + locMeth + "::send error::" + e.getMessage());
			}
    	}
	}
	
	/**
	 * 个人用户注册
	 * @param args
	 * @param response
	 */
	private void registerUser(ArgsPojo args,HttpServletRequest request, HttpServletResponse response,HttpSession httpSession){
		String serviceAddr = authPath;
		JSONObject json = new JSONObject();
		String registerNum = args.getRegisterNum();
		String realName = args.getRealName();
		String pwd = args.getPwd();
		String companyType = args.getCompanyType();
		String isCompany = args.getIsCompany();
		String isWX = args.getIsWX();
		String openId = args.getOpenId();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		logger.info("wape-web::registerUser::isWX::" + isWX);
		logger.info("wape-web::registerUser::openId::" + openId);
		if(null == isCompany){
			companyType = "0";
		}
		json.put("registerNum", registerNum);
	    json.put("registerType", "p");
	    json.put("realyName", EncodingTool.encodeStr(realName));
	    json.put("companyType", companyType);
	    json.put("pwd", pwd);
	    json.put("isWX", isWX);
	    json.put("openId", openId);
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
		
		String serviceToken="411e7bc272a421b44802a9f608a740e5ca74872a";
		String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = registerNum;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "browser";
	    String mac = "00-00-00-00-00-00";
	    String business = buff.toString();

		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		logger.info("wape-web::registerUser::business::" + business);
		String returnString = sendhttp(serviceAddr, params);
		logger.info("wape-web::registerUser::returnString::" + returnString);
		JSONObject returnJson=JSON.parseObject(returnString);
        String returnCode = (String) returnJson.get("returnCode");
        String returnMsg = (String) returnJson.get("returnMsg");
        logger.info("wape-web::registerUser::returnCode::" + returnCode);
        logger.info("wape-web::registerUser::returnMsg::" + returnMsg);
        request.setAttribute("returnCode", returnCode);
        request.setAttribute("returnMsg", returnMsg);
        if("200".equals(returnCode)){
        	try {
        		if(!StringUtils.isEmpty(returnMsg) && returnMsg.indexOf("成功") != -1){
        			returnMsg = "注册" + returnMsg;
	        	}
        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
        			String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wapeWechatAppID + "&redirect_uri=" 
        					+ Constants.WEB_SERVICE_ADDR + "/3g/mine/mine.jsp?returnMsg=" + returnMsg
        					+ "&returnCode=" + returnCode + "&openId=" + openId + "&isWX=" + isWX
        					+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
        			logger.info("wape-web::registerUser::send url::" + url);
        			response.sendRedirect(url);
        			return;
        		}else{
        			request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
        			return;
        		}
			} catch (Exception e) {
    			logger.info("wape-web::registerUser::send error::" + e.getMessage());
			}
        }else{
        	try {
        		if(!StringUtils.isEmpty(isWX) && "yes".equals(isWX)){
        			String url = "/we/w-registered-2.jsp";
        			logger.info("wape-web::registerUser::send::" + url);
        			request.getRequestDispatcher(url).forward(request, response);
        			return;
        		}else{
        			request.getRequestDispatcher("/3g/registered-2.jsp").forward(request, response);
        			return;
        		}
				
			} catch (Exception e) {
    			logger.info("wape-web::registerUser::send error::" + e.getMessage());
			}
        }
	}
	
	/**
	 * 获取openID
	 * @param args
	 * @param response
	 */
	private void getWXOpenId(ArgsPojo args, HttpServletResponse response,HttpServletRequest request){
		Map<String, String> params = new HashMap<String, String>();
		params.put("appid", wapeWechatAppID);
		params.put("secret", wapeWechatAppSecret);
		params.put("code", request.getParameter("code"));
		params.put("grant_type", "authorization_code");
		logger.info("wape-web::getWXOpenId::params:" + params);
        String serviceString = sendhttp("https://api.weixin.qq.com/sns/oauth2/access_token", params);
        JSONObject obj = JSON.parseObject(serviceString);
        logger.info("wape-web::getWXOpenId::openid:" + obj.getString("openid"));
        writeJsonToResponse(response, obj.getString("openid"));
	}
	
	/**
	 * 发送短信验证码
	 * @param args
	 * @param response
	 */
	private void sendSMSCode(ArgsPojo args, HttpServletResponse response,HttpServletRequest request,
			HttpSession httpSession){
		ReturnPojo rp = new ReturnPojo();
		String registerNum = args.getRegisterNum();
		String code = Utils.getSMSCode();
		JSONObject json = new JSONObject();
		json.put("code", code);
		logger.info("nsy-core::sendSMSCode::sms params :" + json.toJSONString());
		String serverUrl = "https://eco.taobao.com/router/rest?format=json";
		String appKey = "23459215";
		String appSecret = "a532e55b36a40dd36c0b10019bdb07e3";
		TaobaoClient client = new DefaultTaobaoClient(serverUrl, appKey, appSecret);
		AlibabaAliqinFcSmsNumSendRequest smsReq = new AlibabaAliqinFcSmsNumSendRequest();
		smsReq.setSmsType("normal");
		smsReq.setSmsFreeSignName("快来网络科技");
		smsReq.setSmsParam(json.toJSONString());
		smsReq.setRecNum(registerNum);
		smsReq.setSmsTemplateCode("SMS_15065034");
		AlibabaAliqinFcSmsNumSendResponse smsRep = null;
		try {
			smsRep = client.execute(smsReq);
		} catch (ApiException e) {
			logger.info("nsy-core::sendSMSCode::client send error :" + e.getMessage());
		}
		if(null == smsRep){
			logger.info("nsy-core::sendSMSCode::return is null::");
			rp.setReturnCode(ReturnCodes.SEND_SMS_FAIL.getCode());
			rp.setReturnMsg(ReturnCodes.SEND_SMS_FAIL.getMessage());
		}else{
			String resultString = smsRep.getBody();
			JSONObject alibabaObject = JSON.parseObject(resultString);
			JSONObject resultObject = alibabaObject.getJSONObject("alibaba_aliqin_fc_sms_num_send_response");
			JSONObject resultObject2 = resultObject	.getJSONObject("result");
			logger.info("nsy-core::sendSMSCode::return info::" +resultObject2.toJSONString());
			String success = resultObject2.getString("success");
			if("true".equals(success)){
				logger.info("nsy-core::sendSMSCode::send ok::");
				rp.setReturnCode(ReturnCodes.SUCCESS.getCode());
				rp.setReturnMsg(ReturnCodes.SUCCESS.getMessage());
				httpSession.setAttribute("smscode", code);
				httpSession.setAttribute("smstime", System.currentTimeMillis());
				
			}else{
				logger.info("nsy-core::sendSMSCode::send error::");
				rp.setReturnCode(ReturnCodes.SEND_SMS_FAIL.getCode());
				rp.setReturnMsg(ReturnCodes.SEND_SMS_FAIL.getMessage());
			}
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * openID自动登录
	 * @param args
	 * @param response
	 */
	private void autoLoginWX(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String openId = args.getOpenId();
		if(!StringUtils.isEmpty(openId)){
			openId = openId.replaceAll("\\n", "").replaceAll("\\r", "");
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::autoLoginWX::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
		logger.info("wape-web::autoLoginWX::openId:" + openId);
		logger.info("wape-web::autoLoginWX::atUserId:" + atUserId);
		if(StringUtils.isEmpty(openId)){
			rp.setReturnCode(ReturnCodes.NOT_GET_OPENID.getCode());
			rp.setReturnMsg(ReturnCodes.NOT_GET_OPENID.getMessage());
		}else{
			//自动登录
			String token1 = "411e7bc272a421b44802a9f608a740e5ca74872a";
			String timestamp1 = Utils.getCurrTimeMillions();
		    String nonce1 = Utils.getNonce();
		    String sign1 = "";
			try {
				sign1 = TokenUtils.getSign(token1, timestamp1, nonce1);
			} catch (NoSuchAlgorithmException e3) {
				logger.error("wape-web::autoLoginWX::sign make error::" + e3.getMessage());
			}
		    String editUserId1 = openId;
		    String editTime1 = timestamp1;
		    JSONObject businessJson1 = new JSONObject();
		    businessJson1.put("openId", openId);
		    String business1 = businessJson1.toString();
			Map<String, String> params1 = new HashMap<String, String>();
			params1.put("serviceCode", "1001W02");
			params1.put("sign", sign1);
			params1.put("timestamp", timestamp1);
			params1.put("nonce", nonce1);
			params1.put("editUserId", editUserId1);
			params1.put("editTime", editTime1);
			params1.put("ipaddr", ipaddr);
			params1.put("device", device);
			params1.put("mac", mac);
			params1.put("business", business1);
			logger.info("wape-web::autoLoginWX::business1 is :" + business1);
			String resultString1 = sendhttp(authPath, params1);
			logger.info("wape-web::autoLoginWX::return::" + resultString1);
			JSONObject resultJson1=JSON.parseObject(resultString1);
			String returnCode1 = resultJson1.getString("returnCode");
			String returnMsg1 = resultJson1.getString("returnMsg");
			logger.info("wape-web::autoLoginWX::return code::" + returnCode1);
			logger.info("wape-web::autoLoginWX::return msg::" + returnMsg1);
			if("200".equals(returnCode1)){
	        	JSONObject result1 = JSON.parseObject(resultJson1.getString("result"));
	        	atUserId = result1.getString("atUserId");
	        	String token2 = result1.getString("token");
	        	//保存用户验证信息
	        	httpSession.setAttribute("atUserId", atUserId);
	        	httpSession.setAttribute("openId", openId);
	        	httpSession.setAttribute("token", token2);
	        	//拉取用户信息
	        	String timestamp2 = Utils.getCurrTimeMillions();
			    String nonce2 = Utils.getNonce();
			    String editTime2 = timestamp2;
	        	String sign2 = "";
				try {
					sign2 = TokenUtils.getSign(token2, timestamp2, nonce2);
				} catch (NoSuchAlgorithmException e3) {
					logger.error("wape-web::autoLoginWX::sign2 make error::" + e3.getMessage());
				}
        		JSONObject businessJson2 = new JSONObject();
        		businessJson2.put("atUserId", atUserId);
        		businessJson2.put("token", token2);
        	    String business2 = businessJson2.toJSONString();
        	    Map<String, String> params2 = new HashMap<String, String>();
        	    params2.put("serviceCode", "5003U01");
        	    params2.put("sign", sign2);
        	    params2.put("timestamp", timestamp2);
        	    params2.put("nonce", nonce2);
        	    params2.put("editUserId", atUserId);
        	    params2.put("editTime", editTime2);
        	    params2.put("ipaddr", ipaddr);
        	    params2.put("device", device);
        	    params2.put("mac", mac);
        	    params2.put("business", business2);
        	    logger.info("wape-web::autoLoginWX::business2::" + business2);
                String resultString2 = sendhttp(authPath, params2);
                logger.info("wape-web::autoLoginWX::return user info::" + resultString2);
                JSONObject resultJson2=JSON.parseObject(resultString2);
                String returnCode2 = resultJson2.getString("returnCode");
    			String returnMsg2 = resultJson2.getString("returnMsg");
                if("200".equals(returnCode2)){
                	JSON son = JSON.parseObject(resultJson2.getString("result"));
                    UserList user = JSONObject.toJavaObject(son, UserList.class);
                    httpSession.setAttribute("user", user);
    	        	rp.setResult(user);
    	        	rp.setReturnCode(ReturnCodes.SUCCESS.getCode());
    				rp.setReturnMsg(ReturnCodes.SUCCESS.getMessage());
                }else{
                	rp.setReturnCode(returnCode2);
    				rp.setReturnMsg(returnMsg2);
                }
			}else{
				rp.setReturnCode(returnCode1);
				rp.setReturnMsg(returnMsg1);
			}
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 公司名称查重
	 * @param args
	 * @param response
	 */
	private void checkCompanyRepeat(ArgsPojo args, HttpServletRequest request,HttpServletResponse response,HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		json.put("companyName", args.getCompanyName());
		json.put("atUserId",serviceAtUserId);
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    String serviceAddr = authPath;
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    
	    Map<String, String> formparamsquery = new HashMap<String, String>();
	    formparamsquery.put("serviceCode", "5003U01");
	    formparamsquery.put("sign", sign);
	    formparamsquery.put("timestamp", timestamp);
	    formparamsquery.put("nonce", nonce);
	    formparamsquery.put("editUserId", serviceAtUserId);
	    formparamsquery.put("editTime", editTime);
	    formparamsquery.put("ipaddr", ipaddr);
	    formparamsquery.put("device", device);
	    formparamsquery.put("mac", mac);
	    formparamsquery.put("business", business);
	    logger.info("wape-web::checkCompanyRepeat::business::" + business);
        String serviceString = sendhttp(serviceAddr, formparamsquery);
        logger.info("wape-web::checkCompanyRepeat::info::" + serviceString);
        JSONObject serviceJson=JSON.parseObject(serviceString);
        String remsg = serviceJson.getString("returnMsg");
        if("200".equals(serviceJson.get("returnCode"))){
        	request.setAttribute("companyName", args.getCompanyName());
        	try {
				request.getRequestDispatcher("/3g/registered-4.jsp").forward(request, response);
			} catch (Exception e) {
				e.printStackTrace();
			}
        }else{
        	request.setAttribute("remsg", remsg);
        	try {
				request.getRequestDispatcher("/3g/registered-3.jsp").forward(request, response);
			} catch (Exception e) {
				e.printStackTrace();
			}
        }
	}
	/**
	 * 企业注册
	 * @param args
	 * @param response
	 */
	private void registerCompany(ArgsPojo args,HttpServletRequest request,HttpServletResponse response,HttpSession httpSession){
		String locMeth = "registerCompany";
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		String companyName = EncodingTool.encodeStr(args.getCompanyName());
		String companyType = args.getCompanyType();
		String adminName = args.getAdminName();
		String adminPhone = args.getAdminPhone();
		json.put("companyName", companyName);
	    json.put("companyType", companyType);
	    json.put("adminName", adminName);
	    json.put("adminPhone", adminPhone);
	    json.put("adminPwd", args.getAdminPwd());
	    json.put("atUserId",serviceAtUserId);
	    String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";	    
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
		String business = buff.toString();
	        String serviceAddr = authPath;
	        Map<String, String> formparamsquery = new HashMap<String, String>();
		    formparamsquery.put("serviceCode", serviceCode);
		    formparamsquery.put("sign", sign);
		    formparamsquery.put("timestamp", timestamp);
		    formparamsquery.put("nonce", nonce);
		    formparamsquery.put("editUserId", serviceAtUserId);
		    formparamsquery.put("editTime", editTime);
		    formparamsquery.put("ipaddr", ipaddr);
		    formparamsquery.put("device", device);
		    formparamsquery.put("mac", mac);
		    formparamsquery.put("business", business);
		    logger.info("wape-web::checkCompanyRepeat::business::" + business);
	        String serviceString = sendhttp(serviceAddr, formparamsquery);
	        logger.info("wape-web::checkCompanyRepeat::info::" + serviceString);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
	        String returnCode = serviceJson.getString("returnCode");
	        String remsg = serviceJson.getString("returnMsg");
	        if("200".equals(returnCode)){
	        	//注册后重新拉取用户信息
	        	JSONObject jsonquery = new JSONObject();
	    		jsonquery.put("atUserId", serviceAtUserId);
	    	    StringBuffer buffquery=new StringBuffer();
	    	    buffquery.append(jsonquery.toJSONString());
	    	    Map<String, String> paramsquery = new HashMap<String, String>();
	    	    paramsquery.put("serviceCode", "5003U01");
	    	    paramsquery.put("sign", sign);
	    	    paramsquery.put("timestamp", timestamp);
	    	    paramsquery.put("nonce", nonce);
	    	    paramsquery.put("editUserId", serviceAtUserId);
	    	    paramsquery.put("editTime", editTime);
	    	    paramsquery.put("ipaddr", ipaddr);
	    	    paramsquery.put("device", device);
	    	    paramsquery.put("mac", mac);
	    	    paramsquery.put("business", buffquery.toString());
	    	    logger.info(preModular + "::" + locMeth + "::query user info business::" + buffquery.toString());
	    		String serviceQuery = sendhttp(serviceAddr, formparamsquery);
	    		logger.info(preModular + "::" + locMeth + "::query user info return::" + serviceQuery);
	    		JSONObject serviceObject=JSON.parseObject(serviceQuery);
	    		if("200".equals(serviceObject.getString("returnCode"))){
	    			JSONObject son = JSON.parseObject(serviceObject.getString("result"));
	                UserList newuser = JSONObject.toJavaObject(son, UserList.class);
	                httpSession.setAttribute("user", newuser);
	    		}else{ //拉取个人信息失败是置空公司信息
	    			UserList user = (UserList) httpSession.getAttribute("user");
	    			user.setCompanyId(serviceAtUserId);
	    			user.setCompanyName(companyName);
//	    			user.setCompanyNickName("");
//	    			user.setCompanyProvince("");
//	    			user.setCompanyCity("");
//	    			user.setCompanyDistrict("");
//	    			user.setMarket("");
	    			user.setCompanyType(companyType);
	    			user.setAdminId(serviceAtUserId);
	    			user.setAdminName(adminName);
//	    			user.setBusinessRegisterCode("");
//	    			user.setDepartmentId("");
//	    			user.setDepartmentName("");
//	    			user.setDistrict("");
	    			user.setFounderId(serviceAtUserId);
	    			user.setFounderName(user.getRealName());
//	    			user.setIndividual("");
//	    			user.setIndustry("");
//	    			user.setViceIndustry("");
//	    			user.setIntroduce("");
//	    			user.setLegalRepresentative("");
//	    			user.setMailbox("");
//	    			user.setPostalAddress("");
//	    			user.setCompanyRqCode("");
//	    			user.setScope("");
//	    			user.setTelephone("");
//	    			user.setTermEnd("");
//	    			user.setTermStart("");
//	    			user.setCompanyThumbnail("");
//	    			user.setWebsite("");
	    		}
	        	if(!StringUtils.isEmpty(remsg) && remsg.indexOf("成功") != -1){
	        		remsg = "注册" + remsg;
	        	}
	        	request.setAttribute("remsg", remsg);
        		try {
//        			response.sendRedirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx167b18378241425a&redirect_uri=" 
//                			+ Constants.WEB_SERVICE_ADDR + "/3g/company/company.jsp?remsg=" + remsg 
//                			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect");
						request.getRequestDispatcher("/3g/company/company.jsp").forward(request, response);
				} catch (Exception e) {
					e.printStackTrace();
				}
	        	
	        }else{
	        	request.setAttribute("remsg", remsg);
	        	try {
					request.getRequestDispatcher("/3g/registered-3.jsp").forward(request, response);
				} catch (Exception e) {
					e.printStackTrace();
				}
	        }
	}
	
	/**
	 * 注销
	 * @param args
	 * @param response
	 */
	private void logout(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		ReturnPojo rp = new ReturnPojo();
		httpSession.invalidate();

//		System.out.println(httpSession.getAttribute("registerNum"));
		try {
			json = new JSONObject();
			rp.setReturnCode("200");
			rp.setReturnMsg("session清除成功！");
		} catch (Exception e) {
			logger.error("wape-web::" + e.getMessage());
			rp.setCheckTime("0");
			rp.setCacheTime("0");
			rp.setReturnCode("500");
			rp.setReturnMsg("500");
		}
			writeJsonToResponse(response, json.toJSON(rp).toString());
	
	}
	/**
	 * 个人信息查询
	 * @param args
	 * @param response
	 */
	private void queryUserInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		json.put("atUserId",serviceAtUserId);
	    json.put("token", serviceToken);
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    // 创建httppost  
	    String serviceAddr = authPath;
	    //String serviceAddr = "http://192.168.0.117:8888/nsy-auth/api/auth/centerService";
	    String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
        String serviceString = sendhttp(serviceAddr, params);
        writeJsonToResponse(response,serviceString);
	}	
	
	/**
	 * 修改个人信息
	 * @param args
	 * @param response
	 */
	private void resetUserInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		UserList user = (UserList) httpSession.getAttribute("user");
		String serviceCodegs = "5003U02";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
		String nickName = args.getNickName();
		String thumbnail = args.getThumbnail();
		String sex = args.getSex();
		String realName = args.getRealName();
		String rqCode = args.getRqCode();
		JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
		json.put("nickName", nickName);
		json.put("thumbnail", thumbnail);
		json.put("sex", sex);
		json.put("realName", realName);
		json.put("rqCode", rqCode);
	    String businessgs = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCodegs);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", businessgs);
		String serviceString = sendhttp(serviceAddrgs, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
		if("200".equals(serviceJson.getString("returnCode"))){
			if(!StringUtils.isEmpty(nickName)){
				user.setNickName(nickName);
			}
			if(!StringUtils.isEmpty(thumbnail)){
				user.setThumbnail(thumbnail);
			}
			if(!StringUtils.isEmpty(sex)){
				user.setSex(sex);
			}
			if(!StringUtils.isEmpty(realName)){
				user.setRealName(realName);
			}
			if(!StringUtils.isEmpty(rqCode)){
				user.setRqCode(rqCode);
			}
		}
//        String restr = serviceJson.getString("result");
	    writeJsonToResponse(response, serviceJson.toJSONString());
	}
	
	/**
	 * 修改公司信息
	 * @param args
	 * @param response
	 */
	private void resetCompanyInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		CompanyList company = (CompanyList)httpSession.getAttribute("company");
		String serviceCodegs = "5003U12";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
		String thumbnail = args.getThumbnail();
		String companyType = args.getCompanyType();
		String province = args.getProvince();
		String city = args.getCity();
		String district = args.getDistrict();
		String market = args.getMarket();
		String industry = args.getIndustry();
		String viceIndustry = args.getViceIndustry();
		String scope = args.getScope();
		String postalAddress = args.getPostalAddress();
		String website = args.getWebsite();
		String telephone = args.getTelephone();
		String mailbox = args.getMailbox();
		String businessRegisterCode = args.getBusinessRegisterCode();
		String legalRepresentative =  args.getLegalRepresentative();
		String termStart = args.getTermStart();
		String termEnd = args.getTermEnd();
		JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
		json.put("thumbnail", thumbnail);
		json.put("companyType", companyType);
		json.put("province", province);
		json.put("city", city);
		json.put("district", district);
		json.put("market", market);
		json.put("industry", industry);
		json.put("viceIndustry", viceIndustry);
		json.put("scope", scope);
		json.put("postalAddress", postalAddress);
		json.put("website", website);
		json.put("telephone", telephone);
		json.put("mailbox", mailbox);
		json.put("businessRegisterCode", businessRegisterCode);
		json.put("legalRepresentative", legalRepresentative);
		json.put("termStart", termStart);
		json.put("termEnd", termEnd);
	    String businessgs = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCodegs);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", businessgs);
		String serviceString = sendhttp(serviceAddrgs, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
        if("200".equals(serviceJson.getString("returnCode"))){
			if(!StringUtils.isEmpty(thumbnail)){
				company.setThumbnail(thumbnail);
			}
			if(!StringUtils.isEmpty(companyType)){
				company.setCompanyType(companyType);
			}
			if(!StringUtils.isEmpty(province)){
				company.setProvince(province);
			}
			if(!StringUtils.isEmpty(city)){
				company.setCity(city);
			}
			if(!StringUtils.isEmpty(district)){
				company.setDistrict(district);
			}
			if(!StringUtils.isEmpty(market)){
				company.setMarket(market);
			}
			if(!StringUtils.isEmpty(industry)){
				company.setIndustry(industry);
			}
			if(!StringUtils.isEmpty(viceIndustry)){
				company.setViceIndustry(viceIndustry);
			}
			if(!StringUtils.isEmpty(scope)){
				company.setScope(scope);
			}
			if(!StringUtils.isEmpty(postalAddress)){
				company.setPostalAddress(postalAddress);
			}
			if(!StringUtils.isEmpty(website)){
				company.setWebsite(website);
			}
			if(!StringUtils.isEmpty(telephone)){
				company.setTelephone(telephone);
			}
			if(!StringUtils.isEmpty(mailbox)){
				company.setMailbox(mailbox);
			}
			if(!StringUtils.isEmpty(businessRegisterCode)){
				company.setBusinessRegisterCode(businessRegisterCode);
			}
			if(!StringUtils.isEmpty(legalRepresentative)){
				company.setLegalRepresentative(legalRepresentative);
			}
			if(!StringUtils.isEmpty(termStart)){
				company.setTermStart(termStart);
			}
			if(!StringUtils.isEmpty(termEnd)){
				company.setTermEnd(termEnd);
			}
		}
//        String restr = serviceJson.getString("result");
	    writeJsonToResponse(response, serviceJson.toJSONString());
	}
	
	/**
	 * 重置密码
	 * @param args
	 * @param response
	 */
	private void resetPwd(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String registerNum = args.getRegisterNum();
		String pwd = args.getPwd();
		String oldpwd = args.getOldpwd();
		String token=(String) httpSession.getAttribute("token");
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = registerNum;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
		JSONObject json = new JSONObject();
		json.put("registerNum", registerNum);
		json.put("pwd", pwd);
		json.put("oldpwd", oldpwd);
	    String business = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "5004U02");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		logger.info("wape-web::resetPwd::business::" + business);
		String serviceString = sendhttp(serviceAddrgs, params);
		logger.info("wape-web::resetPwd::return::" + serviceString);
		JSONObject serviceJson=JSON.parseObject(serviceString);
		String returnCode = serviceJson.getString("returnCode");
		String returnMsg = serviceJson.getString("returnMsg");
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		try {
			logger.info("wape-web::resetPwd::send modify.jsp::");
			request.getRequestDispatcher("/3g/mine/modify.jsp").forward(request, response);
			return;
		} catch (Exception e) {
			logger.info("wape-web::resetPwd::send error::" + e.getMessage());
		}
		
	}
	
	/**
	 * 找回密码
	 * @param args
	 * @param response
	 */
	private void findPwd(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String registerNum = args.getRegisterNum();
		String pwd = args.getPwd();
		String token="411e7bc272a421b44802a9f608a740e5ca74872a";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = registerNum;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String smscode = (String) httpSession.getAttribute("smscode");
	    if(StringUtils.isEmpty(smscode)){
	    	logger.info("wape-web::findPwd::smscode not exists::");
	    	request.setAttribute("returnCode", ReturnCodes.SMS_CODE_NOT_EXISTS.getCode());
			request.setAttribute("returnMsg", ReturnCodes.SMS_CODE_NOT_EXISTS.getMessage());
			try {
				logger.info("wape-web::findPwd::send forgot::");
				request.getRequestDispatcher("/3g/forgot.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::findPwd::send error::" + e.getMessage());
			}
	    }
	    long smstime = (long) httpSession.getAttribute("smstime");
	    long currtime = System.currentTimeMillis();
	    if((currtime - smstime) > 300017){ // 超时5分钟
	    	logger.info("wape-web::findPwd::smscode time out::");
			request.setAttribute("returnCode", ReturnCodes.SMS_CODE_TIME_OUT.getCode());
			request.setAttribute("returnMsg", ReturnCodes.SMS_CODE_TIME_OUT.getMessage());
			httpSession.removeAttribute("smscode");
			httpSession.removeAttribute("smstime");
			try {
				logger.info("wape-web::findPwd::send forgot::");
				request.getRequestDispatcher("/3g/forgot.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::findPwd::send error::" + e.getMessage());
			}
	    }
		String code = args.getCode();
		logger.info("wape-web::findPwd::smscode::" + smscode);
		httpSession.removeAttribute("smscode");
		httpSession.removeAttribute("smstime");
		if(smscode.equals(code)){ //短信验证通过
			JSONObject json = new JSONObject();
			json.put("registerNum", registerNum);
			json.put("pwd", pwd);
		    String business = json.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "5004U02");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
			logger.info("wape-web::findPwd::business::" + business);
			String serviceString = sendhttp(serviceAddrgs, params);
			logger.info("wape-web::findPwd::return::" + serviceString);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			String returnCode = serviceJson.getString("returnCode");
			String returnMsg = serviceJson.getString("returnMsg");
			request.setAttribute("returnCode", returnCode);
			request.setAttribute("returnMsg", returnMsg);
			try {
				logger.info("wape-web::findPwd::send forgot.jsp::");
				request.getRequestDispatcher("/3g/forgot.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::findPwd::send error::" + e.getMessage());
			}
		}else{
			logger.info("wape-web::findPwd::smscode error::");
			request.setAttribute("returnCode", ReturnCodes.SMS_CODE_FAIL.getCode());
			request.setAttribute("returnMsg", ReturnCodes.SMS_CODE_FAIL.getMessage());
			try {
				logger.info("wape-web::findPwd::send forgot::");
				request.getRequestDispatcher("/3g/forgot.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::findPwd::send error::" + e.getMessage());
			}
		}
		
	}
	
	/**
	 * 公司模糊查询
	 * @param args
	 * @param response
	 */
	private void queryVagueCompany(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		String companyName = EncodingTool.encodeStr(args.getCompanyName());
		json.put("atUserId",serviceAtUserId);
		json.put("companyName",companyName);
		json.put("count","10");
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    String serviceAddr = authPath;
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "5006U04");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
        String serviceString = sendhttp(serviceAddr, params);
        logger.error("wape-web::queryVagueCompany::business::" + business);
        logger.error("wape-web::queryVagueCompany::return::" + serviceString);
        JSONObject obj = JSON.parseObject(serviceString);
        JSONObject comps = JSON.parseObject(obj.getString("result"));
        JSONArray array = comps.getJSONArray("companys");
        JSONArray tag = new JSONArray();
        if(null == array){
        	
        }else{
        	for (int i = 0,size = array.size(); i < size; i++) {
            	JSONObject job = array.getJSONObject(i);
            	JSONObject tagob = new JSONObject();
            	tagob.put("label", job.getString("companyName"));
            	tagob.put("value", job.getString("companyId"));
            	tag.add(tagob);
    		}
        }
        writeJsonToResponse(response,tag.toJSONString());
	}
	
	/**
	 * 公司模糊查询至页面
	 * @param args
	 * @param response
	 */
	private void queryVagueCompanyToPage(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		String companyName = EncodingTool.encodeStr(args.getCompanyName());
		json.put("atUserId",serviceAtUserId);
		json.put("companyName",companyName);
		json.put("count","99999");
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    String serviceAddr = authPath;
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "5006U04");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
        String serviceString = sendhttp(serviceAddr, params);
        logger.error("wape-web::queryVagueCompanyToPage::business::" + business);
        logger.error("wape-web::queryVagueCompanyToPage::return::" + serviceString);
        JSONObject obj = JSON.parseObject(serviceString);
        JSONObject comps = JSON.parseObject(obj.getString("result"));
        JSONArray array = comps.getJSONArray("companys");
        List<CompanyList> list = JSONArray.toJavaObject(array, List.class);
        request.setAttribute("cps", list);
        try {
			request.getRequestDispatcher("/3g/company/company-4.jsp").forward(request, response);
		} catch (Exception e) {
			logger.error("wape-web::queryVagueCompanyToPage::send error::" + e.getMessage());
			e.printStackTrace();
		}
	}
	
	/**
	 * 离开公司
	 * @param args
	 * @param response
	 */
	private void exitCompany(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		String locMeth = "exitCompany";
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		UserList user = (UserList) httpSession.getAttribute("user");
		String serviceToken=(String) httpSession.getAttribute("token");
		json.put("atUserId",user.getAtUserId());
		json.put("companyId",user.getCompanyId());
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    String serviceAddr = authPath;
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "5006U08");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		logger.error("wape-web::exitCompany::business::" + business);
        String serviceString = sendhttp(serviceAddr, params);
        JSONObject serviceJson = JSON.parseObject(serviceString);
        logger.error("wape-web::exitCompany::return::" + serviceString);
        if("200".equals(serviceJson.get("returnCode"))){
        	//成功后重新拉取用户信息
        	JSONObject jsonquery = new JSONObject();
    		jsonquery.put("atUserId", serviceAtUserId);
    	    StringBuffer buffquery=new StringBuffer();
    	    buffquery.append(jsonquery.toJSONString());
    	    Map<String, String> formparamsquery = new HashMap<String, String>();
    	    formparamsquery.put("serviceCode", "5003U01");
    	    formparamsquery.put("sign", sign);
    	    formparamsquery.put("timestamp", timestamp);
    	    formparamsquery.put("nonce", nonce);
    	    formparamsquery.put("editUserId", editUserId);
    	    formparamsquery.put("editTime", editTime);
    	    formparamsquery.put("ipaddr", ipaddr);
    	    formparamsquery.put("device", device);
    	    formparamsquery.put("mac", mac);
    	    formparamsquery.put("business", buffquery.toString());
    	    logger.info(preModular + "::" + locMeth + "::query user info business::" + buffquery.toString());
    		String serviceQuery = sendhttp(serviceAddr, formparamsquery);
    		logger.info(preModular + "::" + locMeth + "::query user info return::" + serviceQuery);
    		JSONObject serviceObject=JSON.parseObject(serviceQuery);
    		if("200".equals(serviceObject.getString("returnCode"))){
    			JSONObject son = JSON.parseObject(serviceObject.getString("result"));
                UserList newuser = JSONObject.toJavaObject(son, UserList.class);
                httpSession.setAttribute("user", newuser);
    		}else{ //拉取个人信息失败是置空公司信息
    			user.setCompanyId("");
    			user.setCompanyName("");
    			user.setCompanyNickName("");
    			user.setCompanyProvince("");
    			user.setCompanyCity("");
    			user.setCompanyDistrict("");
    			user.setMarket("");
    			user.setCompanyType("");
    			user.setAdminId("");
    			user.setAdminName("");
    			user.setBusinessRegisterCode("");
    			user.setDepartmentId("");
    			user.setDepartmentName("");
    			user.setDistrict("");
    			user.setFounderId("");
    			user.setFounderName("");
    			user.setIndividual("");
    			user.setIndustry("");
    			user.setViceIndustry("");
    			user.setIntroduce("");
    			user.setLegalRepresentative("");
    			user.setMailbox("");
    			user.setPostalAddress("");
    			user.setCompanyRqCode("");
    			user.setScope("");
    			user.setTelephone("");
    			user.setTermEnd("");
    			user.setTermStart("");
    			user.setCompanyThumbnail("");
    			user.setWebsite("");
    		}
            
			rp.setReturnCode("200");
			rp.setReturnMsg("200");
		}else{
			rp.setReturnCode("500");
			rp.setReturnMsg("500");
		}
        writeJsonToResponse(response,json.toJSON(rp).toString());
	}
	
	/**
	 * 查询要加入的公司信息
	 * @param args
	 * @param response
	 */
	private void queryJoinCompanyInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		json.put("atUserId",serviceAtUserId);
	    json.put("token", serviceToken);
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    // 创建httppost  
	    String serviceAddr = authPath;
	    String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
        String serviceString = sendhttp(serviceAddr, params);
        JSONObject rsljson = JSON.parseObject(serviceString);
        if("200".equals(rsljson.getString("returnCode"))){
        	JSONObject cljson = JSON.parseObject(rsljson.getString("result"));
            CompanyList cl = JSON.toJavaObject(rsljson, CompanyList.class);
            request.setAttribute("company", cl);
            //跳转
        }else{
        	//跳转
        }
	}	
	
	/**
	 * 查询要加入的公司组织架构信息
	 * @param args
	 * @param response
	 */
	private void queryJoinCompanyDepart(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession){
		JSONObject json = new JSONObject();
		String serviceAtUserId=(String) httpSession.getAttribute("atUserId");
		String serviceToken=(String) httpSession.getAttribute("token");
		json.put("atUserId",serviceAtUserId);
	    json.put("token", serviceToken);
	    StringBuffer buff=new StringBuffer();
		buff.append(json.toJSONString());
	    // 创建httppost  
	    String serviceAddr = authPath;
	    String serviceCode = args.getServiceCode();
	    String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(serviceToken, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = serviceAtUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    String business = buff.toString();
	    Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
        String serviceString = sendhttp(serviceAddr, params);
        JSONObject rsljson = JSON.parseObject(serviceString);
        if("200".equals(rsljson.getString("returnCode"))){
        	JSONObject cljson = JSON.parseObject(rsljson.getString("result"));
            CompanyList cl = JSON.toJavaObject(rsljson, CompanyList.class);
            request.setAttribute("company", cl);
            //跳转
        }else{
        	//跳转
        }
	}	
	
	/**
	 * 资金查询
	 * @param args
	 * @param response
	 */
	private void queryMoney(ArgsPojo args, HttpServletResponse response, HttpServletRequest request){
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		try {
			json = new JSONObject();
			rp.setReturnCode("200");
			rp.setReturnMsg("200");
		} catch (Exception e) {
			logger.error("wape-web::" + e.getMessage());
			rp.setCheckTime("0");
			rp.setCacheTime("0");
			rp.setReturnCode("500");
			rp.setReturnMsg("500");
		}
		
		
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}


	/**
	 * 查询申购表头
	 * @param args
	 * @param response
	 */
	private void queryParchaseHeader(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
		    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		
		if(null == companyId){
			request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryParchaseHeader::company is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("sendCompanyId", companyId);
		    json.put("count", "20");
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    StringBuffer buffgs=new StringBuffer();
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddr, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            Object resultObject=serviceJson.get("result");
            String tokenString = "";
            JSONArray tokenJson = null;
            if(null != resultObject){
            	tokenString=resultObject.toString();
            	if("[]".equals(tokenString)){
            		tokenJson = new JSONArray();
            	}else{
            		tokenJson=JSONArray.parseArray(tokenString);
            	}
            }
            if("200".equals(serviceJson.get("returnCode"))){
            	List<PurchaseHeader> phs = new ArrayList<PurchaseHeader>();
            	for(int i = 0, size = tokenJson.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) tokenJson.get(i);
            		PurchaseHeader ph = JSONObject.toJavaObject(jsont, PurchaseHeader.class);
            		phs.add(ph);
            	}
            	logger.info("get purchase header, size :" + phs.size());
            	request.setAttribute("purchaseHeaders", phs);
            	httpSession.setAttribute("companyId", companyId);
            	try {
					request.getRequestDispatcher("/3g/purchasing/requisitions.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryParchaseHeader::" + e.getMessage());
				}
            }else{
            	request.setAttribute("error", "W1001");
            	try {
					request.getRequestDispatcher("/3g/purchasing/requisitions.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryParchaseHeader::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 查询询价表头
	 * @param args
	 * @param response
	 */
	private void queryInquiryHeader(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
			String serviceAddr = productPath;
			String serviceAddrgs = authPath;
			String atUserId=(String) httpSession.getAttribute("atUserId");
			String token=(String) httpSession.getAttribute("token");
			String serviceCodegs = "5003U11";
			String serviceCode = args.getServiceCode();
			String timestamp = Utils.getCurrTimeMillions();
		    String nonce = Utils.getNonce();
		    String sign = "";
			try {
				sign = TokenUtils.getSign(token, timestamp, nonce);
			} catch (NoSuchAlgorithmException e3) {
				logger.error("sign make error::" + e3.getMessage());
			}
		    String editUserId = atUserId;
		    String editTime = Utils.getCurrTime();
		    String ipaddr = "";
			try {
				ipaddr = Utils.getIpAddress(request);
			} catch (IOException e2) {
				logger.error("ip not get::" + e2.getMessage());
			}
		    String device = "pc";
		    String mac = "00-00-00-00-000";
		    
			CompanyList company = null;
			String companyId=(String) httpSession.getAttribute("companyId");
			if(null == companyId){
				JSONObject json = new JSONObject();
				json.put("atUserId", atUserId);
			    json.put("frontId", args.getFrontId());
			    String businessgs = json.toString();
			    
				Map<String, String> params = new HashMap<String, String>();
				params.put("serviceCode", serviceCodegs);
				params.put("sign", sign);
				params.put("timestamp", timestamp);
				params.put("nonce", nonce);
				params.put("editUserId", editUserId);
				params.put("editTime", editTime);
				params.put("ipaddr", ipaddr);
				params.put("device", device);
				params.put("mac", mac);
				params.put("business", businessgs);
				String serviceString = sendhttp(serviceAddrgs, params);
				JSONObject serviceJson=JSON.parseObject(serviceString);
		        JSONObject resultObject=(JSONObject) serviceJson.get("result");
		        company = JSON.toJavaObject(resultObject, CompanyList.class);
		        if(null != company){
		        	companyId = company.getCompanyId();
		        }
			}
			
			if(null == companyId){
	        	request.setAttribute("error", "W1001");
	        	try {
					request.getRequestDispatcher("/3g/purchasing/requisitions.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryInquiryHeader::company is null" + e.getMessage());
				}
			}else{
				JSONObject json = new JSONObject();
				json.put("atUserId", atUserId);
			    json.put("sendCompanyId", companyId);
			    json.put("count", "20");
			    StringBuffer buff=new StringBuffer();
				buff.append(json.toJSONString());
			    String business = json.toString();
		        // 创建参数队列    
			    Map<String, String> params = new HashMap<String, String>();
				params.put("serviceCode", serviceCode);
				params.put("sign", sign);
				params.put("timestamp", timestamp);
				params.put("nonce", nonce);
				params.put("editUserId", editUserId);
				params.put("editTime", editTime);
				params.put("ipaddr", ipaddr);
				params.put("device", device);
				params.put("mac", mac);
				params.put("business", business);
		        String serviceString = sendhttp(serviceAddr, params);
		        JSONObject serviceJson=JSON.parseObject(serviceString);
	            Object resultObject=serviceJson.get("result");
	            String tokenString = "";
	            JSONArray tokenJson = null;
	            if(null != resultObject){
	            	tokenString=resultObject.toString();
	            	if("[]".equals(tokenString)){
	            		tokenJson = new JSONArray();
	            	}else{
	            		tokenJson=JSONArray.parseArray(tokenString);
	            	}
	            }
	            if("200".equals(serviceJson.get("returnCode"))){
	            	List<InquiryHeader> ihs = new ArrayList<InquiryHeader>();
                	for(int i = 0, size = tokenJson.size(); i < size; i++){
                		JSONObject jsont = (JSONObject) tokenJson.get(i);
                		InquiryHeader ih = JSONObject.toJavaObject(jsont, InquiryHeader.class);
                		ihs.add(ih);
                	}
                	logger.info("get inquiry header, size :" + ihs.size());
                	request.setAttribute("inquiryHeaders", ihs);
                	try {
						request.getRequestDispatcher("/3g/purchasing/requisitions-2.jsp").forward(request, response);
						return;
					} catch (Exception e) {
						e.printStackTrace();
					}
	            }else{
	            	request.setAttribute("error", "W1001");
                	try {
						request.getRequestDispatcher("/3g/purchasing/requisitions-2.jsp").forward(request, response);
						return;
					} catch (Exception e) {
						e.printStackTrace();
					}
	            }
			}
	}
	
	/**
	 * 查询询价详情
	 * @param args
	 * @param response
	 */
	private void queryInquiryDetail(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		InquiryHeader ih = new InquiryHeader();
		ih.setGoodsKingdom(EncodingTool.encodeStr(args.getGoodsKingdom()));
		ih.setSendUserId(args.getSendUserId());
		ih.setSendUserName(EncodingTool.encodeStr(args.getSendUserName()));
		ih.setSendTime(args.getSendTime());
		ih.setEntriesNum(args.getEntriesNum());
		ih.setIntroduction(EncodingTool.encodeStr(args.getIntroduction()));
		ih.setInquiryState(args.getPurchaseState());
		ih.setSendDepartName(EncodingTool.encodeStr(args.getSendDepartName()));
		ih.setValidity(args.getValidity());
		ih.setReceiptAddress(EncodingTool.encodeStr(args.getReceiptAddress()));
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
	    json.put("frontId", args.getFrontId());
	    String business = json.toString();
		
		String serviceAddr = productPath;
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		String serviceString = sendhttp(serviceAddr, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
        Object resultObject=serviceJson.get("result");
        String tokenString = "";
        JSONArray tokenJson = null;
        if(null != resultObject){
        	tokenString=resultObject.toString();
        	if("[]".equals(tokenString)){
        		tokenJson = new JSONArray();
        	}else{
        		tokenJson=JSONArray.parseArray(tokenString);
        	}
        }
        if("200".equals(serviceJson.get("returnCode"))){
        	List<InquiryList> ehs = new ArrayList<InquiryList>();
        	for(int i = 0, size = tokenJson.size(); i < size; i++){
        		JSONObject jsont = (JSONObject) tokenJson.get(i);
        		InquiryList eh = JSONObject.toJavaObject(jsont, InquiryList.class);
        		ehs.add(eh);
        	}
        	logger.info("get Inquiry list ::" + ehs.size());
        	request.setAttribute("pls",ehs);
        	request.setAttribute("ph",ih);
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-5.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("200 forward ::" + e.getMessage());
			}
        }else{
        	request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-5.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("not 200 forward ::" + e.getMessage());
			}
        }
		//===================================================================
	}
		
	/**
	 * 查询报价表头
	 * @param args
	 * @param response
	 */
	private void queryQuoteHeader(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
		    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		
		if(null == companyId){
			request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-3.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryInquiryHeader::company is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("recCompanyId", companyId);
		    json.put("count", "20");
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    StringBuffer buffgs=new StringBuffer();
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddr, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            Object resultObject=serviceJson.get("result");
            String tokenString = "";
            JSONArray tokenJson = null;
            if(null != resultObject){
            	tokenString=resultObject.toString();
            	if("[]".equals(tokenString)){
            		tokenJson = new JSONArray();
            	}else{
            		tokenJson=JSONArray.parseArray(tokenString);
            	}
            }
            if("200".equals(serviceJson.get("returnCode"))){
            	List<QuoteHeader> phs = new ArrayList<QuoteHeader>();
            	for(int i = 0, size = tokenJson.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) tokenJson.get(i);
            		QuoteHeader ph = JSONObject.toJavaObject(jsont, QuoteHeader.class);
            		phs.add(ph);
            	}
            	logger.info("get quote header, size :" + phs.size());
            	request.setAttribute("quoteHeaders", phs);
            	httpSession.setAttribute("companyId", companyId);
            	try {
					request.getRequestDispatcher("/3g/purchasing/requisitions-3.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryParchaseHeader::" + e.getMessage());
				}
            }else{
            	request.setAttribute("error", "W1001");
            	try {
					request.getRequestDispatcher("/3g/purchasing/requisitions-3.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryParchaseHeader::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 查询报价详情
	 * @param args
	 * @param response
	 */
	private void queryQuoteDetail(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		QuoteHeader qh = new QuoteHeader();
		qh.setGoodsKingdom(EncodingTool.encodeStr(args.getGoodsKingdom()));
		qh.setSendUserId(args.getSendUserId());
		qh.setSendUserName(EncodingTool.encodeStr(args.getSendUserName()));
		qh.setSendTime(args.getSendTime());
		qh.setEntriesNum(args.getEntriesNum());
		qh.setIntroduction(EncodingTool.encodeStr(args.getIntroduction()));
		qh.setInquiryState(args.getPurchaseState());
		qh.setSendDepartName(EncodingTool.encodeStr(args.getSendDepartName()));
		qh.setValidity(args.getValidity());
		qh.setReceiptAddress(EncodingTool.encodeStr(args.getReceiptAddress()));
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
	    json.put("frontId", args.getFrontId());
	    String business = json.toString();
		
		String serviceAddr = productPath;
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		String serviceString = sendhttp(serviceAddr, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
        Object resultObject=serviceJson.get("result");
        String tokenString = "";
        JSONArray tokenJson = null;
        if(null != resultObject){
        	tokenString=resultObject.toString();
        	if("[]".equals(tokenString)){
        		tokenJson = new JSONArray();
        	}else{
        		tokenJson=JSONArray.parseArray(tokenString);
        	}
        }
        if("200".equals(serviceJson.get("returnCode"))){
        	List<QuoteList> ehs = new ArrayList<QuoteList>();
        	for(int i = 0, size = tokenJson.size(); i < size; i++){
        		JSONObject jsont = (JSONObject) tokenJson.get(i);
        		QuoteList eh = JSONObject.toJavaObject(jsont, QuoteList.class);
        		ehs.add(eh);
        	}
        	logger.info("get quote list ::" + ehs.size());
        	request.setAttribute("pls",ehs);
        	request.setAttribute("ph",qh);
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-6.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("200 forward ::" + e.getMessage());
			}
        }else{
        	request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-6.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("not 200 forward ::" + e.getMessage());
			}
        }
		//===================================================================
	}
	
	/**
	 * 查询申购详情
	 * @param args
	 * @param response
	 */
	private void queryParchaseDetail(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//"&goodsKingdom=&sendUserId=&sendUserName=&sendTime=&entriesNum=&introduction=&purchaseState=&sendDepartName=&validity=&receiptAddress="
		PurchaseHeader ph = new PurchaseHeader();
		ph.setGoodsKingdom(EncodingTool.encodeStr(args.getGoodsKingdom()));
		ph.setSendUserId(args.getSendUserId());
		ph.setSendUserName(EncodingTool.encodeStr(args.getSendUserName()));
		ph.setSendTime(args.getSendTime());
		ph.setEntriesNum(args.getEntriesNum());
		ph.setIntroduction(EncodingTool.encodeStr(args.getIntroduction()));
		ph.setPurchaseState(args.getPurchaseState());
		ph.setSendDepartName(EncodingTool.encodeStr(args.getSendDepartName()));
		ph.setValidity(args.getValidity());
		ph.setReceiptAddress(EncodingTool.encodeStr(args.getReceiptAddress()));
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
	    json.put("frontId", args.getFrontId());
	    String business = json.toString();
		
		String serviceAddr = productPath;
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCode);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", business);
		String serviceString = sendhttp(serviceAddr, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
        Object resultObject=serviceJson.get("result");
        String tokenString = "";
        JSONArray tokenJson = null;
        if(null != resultObject){
        	tokenString=resultObject.toString();
        	if("[]".equals(tokenString)){
        		tokenJson = new JSONArray();
        	}else{
        		tokenJson=JSONArray.parseArray(tokenString);
        	}
        }
        if("200".equals(serviceJson.get("returnCode"))){
        	List<PurchaseList> ehs = new ArrayList<PurchaseList>();
        	for(int i = 0, size = tokenJson.size(); i < size; i++){
        		JSONObject jsont = (JSONObject) tokenJson.get(i);
        		PurchaseList eh = JSONObject.toJavaObject(jsont, PurchaseList.class);
        		ehs.add(eh);
        	}
        	logger.info("get purchase list ::" + ehs.size());
        	request.setAttribute("pls",ehs);
        	request.setAttribute("ph",ph);
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-4.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("200 forward ::" + e.getMessage());
			}
        }else{
        	request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/purchasing/requisitions-4.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("not 200 forward ::" + e.getMessage());
			}
        }
		//===================================================================
	}

	//==========================================================粤西接口
	/**
	 * 粤西查询商品
	 * @param args
	 * @param response
	 */
	private void queryProductYX(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		
		if(null == companyId){
			request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/mmzs/parking.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryProductYX::company is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("goodsKingdom", "粤西常见水果");
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddr, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            Object resultObject=serviceJson.get("result");
            String tokenString = "";
            JSONArray tokenJson = null;
            if(null != resultObject){
            	tokenString=resultObject.toString();
            	if("[]".equals(tokenString)){
            		tokenJson = new JSONArray();
            	}else{
            		tokenJson=JSONArray.parseArray(tokenString);
            	}
            }
            if("200".equals(serviceJson.get("returnCode"))){
            	List<Goods> phs = new ArrayList<Goods>();
            	for(int i = 0, size = tokenJson.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) tokenJson.get(i);
            		Goods ph = JSONObject.toJavaObject(jsont, Goods.class);
            		phs.add(ph);
            	}
            	logger.info("get goods, size :" + phs.size());
            	request.setAttribute("goods", phs);
            	httpSession.setAttribute("companyId", companyId);
            	try {
					request.getRequestDispatcher("/3g/mmzs/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryProductYX::" + e.getMessage());
				}
            }else{
            	request.setAttribute("error", "W1001");
            	try {
					request.getRequestDispatcher("/3g/mmzs/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryProductYX::" + e.getMessage());
				}
            }
		}
	}
	
	
	/**
	 * 粤西添加商品
	 * @param args
	 * @param response
	 */
	private void addProductYX(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		if(null == companyId){
			logger.info("wape-web::addProductYX:: companyId is null");
			writeJsonToResponse(response, "{returnCode:\"W2001\"}");
			return;
//			request.setAttribute("error", "W1001");
//        	try {
//        		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=3000P01");
////				request.getRequestDispatcher("wape-web/api/core/centerService?serviceCode=3000P01").forward(request, response);
//			} catch (Exception e) {
//				logger.info("wape-web::addProductYX::company is null" + e.getMessage());
//			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("companyId", companyId);
		    Goods goods = new Goods();
		    goods.setCompanyId(companyId);
		    goods.setSon(EncodingTool.encodeStr(args.getSon()));
		    goods.setFather(EncodingTool.encodeStr(args.getFatherName()));
		    json.put("goods", goods);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddr, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
//            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=3000P01");
//					request.getRequestDispatcher("wape-web/api/core/centerService?serviceCode=3000P01").forward(request, response);
            		writeJsonToResponse(response, "{returnCode:\"200\"}");
				} catch (Exception e) {
					logger.info("wape-web::addProductYX::" + e.getMessage());
				}
            }else{
//            	request.setAttribute("error", "W1001");
            	writeJsonToResponse(response, "{returnCode:\"W2001\"}");
            	logger.info("wape-web::addProductYX::add product error");
            }
		}
	}
	
	
	/**
	 * 粤西删除商品
	 * @param args
	 * @param response
	 */
	private void deleteProductYX(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		if(null == companyId){
			request.setAttribute("error", "W1001");
        	try {
        		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=3000P01");
//				request.getRequestDispatcher("/3g/parking-2.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::deleteProductYX::company is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			Goods goods = new Goods();
			goods.setGoodsId(args.getGoodsId());
		    json.put("goods", goods);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddr, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=3000P01");
//					request.getRequestDispatcher("/3g/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::deleteProductYX::" + e.getMessage());
				}
            }else{
            	request.setAttribute("error", "W1001");
            	try {
            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=3000P01");
//					request.getRequestDispatcher("/3g/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::deleteProductYX::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 粤西水果棚
	 * @param args
	 * @param response
	 */
	private void queryShed(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		//表示不同的车位区域, 1000:大棚区, 1200:临时区, 1300:蔬菜区, 1400:海鲜区, 1500:冻品, 1600
	    String t_p = args.getT_p();
	    if(t_p == null) t_p = "1000";
	    List<String> list = new ArrayList<String>();
	    for(CarParkArea cpa:CarParkArea.values()) {
	    	list.add(cpa.getType());
	    }
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话已失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("type", "2");
		    json.put("parkArea", t_p);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
    		JSONObject result = serviceJson.getJSONObject("result");
            if(null != result){
        		JSONArray parkArea = result.getJSONArray("parkArea");
        		JSONArray parkPos = result.getJSONArray("parkPos");
        		JSONObject parks = result.getJSONObject("parks");
        		request.setAttribute("parkArea", t_p);
        		List<CompanyDepartment> parkAreaList = JSONArray.toJavaObject(parkArea, List.class);
        		request.setAttribute("parkAreaList", parkAreaList);
        		List<CompanyDepartment> parkPosList = JSONArray.toJavaObject(parkPos, List.class);
        		request.setAttribute("parkPosList", parkPosList);
        		Map<String,List<CompanyDepartment>> parkList = JSONArray.toJavaObject(parks, Map.class);
        		request.setAttribute("parkList", parkList);
            }
	        
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
            		request.setAttribute("carParkArea", t_p);
					request.getRequestDispatcher("/3g/mmzs/parking.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }
		}
	}
	
	private void lockCar(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话已失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("parkState", args.getParkState());
			json.put("sonStoreId", args.getSonStoreId());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			//检查车位状态是否改变
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			
			//成功锁定
			if("200".equals(serviceJson.get("returnCode"))){
				String t_p = "1000";
				//查询车位
				JSONObject j1 = new JSONObject();
				j1.put("atUserId", atUserId);
				j1.put("type", "2");
				j1.put("parkArea", t_p);
			    StringBuffer buff1=new StringBuffer();
				buff1.append(j1.toJSONString());
			    String business1 = j1.toString();
		        // 创建参数队列    
			    Map<String, String> params1 = new HashMap<String, String>();
				params1.put("serviceCode", "MMZS108");
				params1.put("sign", sign);
				params1.put("timestamp", timestamp);
				params1.put("nonce", nonce);
				params1.put("editUserId", editUserId);
				params1.put("editTime", editTime);
				params1.put("ipaddr", ipaddr);
				params1.put("device", device);
				params1.put("mac", mac);
				params1.put("realName", userlist.getRealName());
				params1.put("companyId", userlist.getCompanyId());
				params1.put("companyName", userlist.getCompanyName());
				params1.put("departmentId", userlist.getDepartmentId());
				params1.put("departmentName", userlist.getDepartmentName());
				params1.put("business", business1);
		        String serviceString1 = sendhttp(serviceAddrgs, params1);
		        JSONObject serviceJson1=JSON.parseObject(serviceString1);
	    		JSONObject result = serviceJson1.getJSONObject("result");
	            if(null != result){
	        		JSONArray parkArea = result.getJSONArray("parkArea");
	        		JSONArray parkPos = result.getJSONArray("parkPos");
	        		JSONObject parks = result.getJSONObject("parks");
	        		request.setAttribute("sonStoreId", args.getSonStoreId());
	        		request.setAttribute("sonStoreName", args.getSonStoreName());
	        		request.setAttribute("parkArea", t_p);
	        		List<CompanyDepartment> parkAreaList = JSONArray.toJavaObject(parkArea, List.class);
	        		request.setAttribute("parkAreaList", parkAreaList);
	        		List<CompanyDepartment> parkPosList = JSONArray.toJavaObject(parkPos, List.class);
	        		request.setAttribute("parkPosList", parkPosList);
	        		Map<String,List<CompanyDepartment>> parkList = JSONArray.toJavaObject(parks, Map.class);
	        		request.setAttribute("parkList", parkList);
	            }
		        
	            //查询成功
	            if("200".equals(serviceJson1.get("returnCode"))){
	            	try {
	            		request.setAttribute("carParkArea", t_p);
						//消息通知其他进入换车位界面的用户, 锁定挪车位按钮
	            		Event event = Event.createDataEvent("/wape/updateCarLock");
	            		event.setField("currSonStoreId", args.getSonStoreId());
	            		event.setField("locked", "1");
	            		Dispatcher.getInstance().multicast(event);
	            		
						request.setAttribute("currSonStoreId", args.getSonStoreId());
						request.setAttribute("currSonStoreName", args.getSonStoreName());
						
						request.getRequestDispatcher("/3g/mmzs/parking-3.jsp").forward(request, response);
					} catch (Exception e) {
						logger.info("wape-web::queryShed::" + e.getMessage());
					}
	            } else{
					String remsg = "系统错误, 请联系管理员!";
					remsg = serviceJson1.getString("returnMsg");
					try {
						request.setAttribute("remsg", remsg);
	            		
						request.getRequestDispatcher("/3g/mmzs/parking-2.jsp").forward(request, response);
					} catch (Exception e) {
						logger.info("wape-web::queryShed::" + e.getMessage());
					}
				}
			} else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("remsg", remsg);
            		
					request.getRequestDispatcher("/3g/mmzs/parking.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}
		}
	}
	
	private void chooseCar(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		//表示不同的车位区域, 1000:大棚区, 1200:临时区, 1300:蔬菜区, 1400:海鲜区, 1500:冻品, 1600
	    String t_p = args.getT_p();
	    if(t_p == null) t_p = "1000";
	    List<String> list = new ArrayList<String>();
	    for(CarParkArea cpa:CarParkArea.values()) {
	    	list.add(cpa.getType());
	    }
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话已失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("type", "2");
		    json.put("parkArea", t_p);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "MMZS108");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
    		JSONObject result = serviceJson.getJSONObject("result");
            if(null != result){
        		JSONArray parkArea = result.getJSONArray("parkArea");
        		JSONArray parkPos = result.getJSONArray("parkPos");
        		JSONObject parks = result.getJSONObject("parks");
        		request.setAttribute("sonStoreId", args.getSonStoreId());
        		request.setAttribute("sonStoreName", args.getSonStoreName());
        		request.setAttribute("parkArea", t_p);
        		List<CompanyDepartment> parkAreaList = JSONArray.toJavaObject(parkArea, List.class);
        		request.setAttribute("parkAreaList", parkAreaList);
        		List<CompanyDepartment> parkPosList = JSONArray.toJavaObject(parkPos, List.class);
        		request.setAttribute("parkPosList", parkPosList);
        		Map<String,List<CompanyDepartment>> parkList = JSONArray.toJavaObject(parks, Map.class);
        		request.setAttribute("parkList", parkList);
            }
	        
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
            		request.setAttribute("carParkArea", t_p);
					request.getRequestDispatcher("/3g/mmzs/parking-3.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }
		}
	}
	
	private void compareCar(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话已失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("oldSonStoreId", args.getOldSonStoreId());
			json.put("sonStoreId", args.getSonStoreId());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			JSONObject result = serviceJson.getJSONObject("result");
			String page = "/3g/mmzs/parking-4.jsp";
			if(null != result){
				JSONObject store = result.getJSONObject("store");
				JSONObject oldStore = result.getJSONObject("oldStore");
				String costType = oldStore.getString("costType");
				if("30".equals(costType)) {
					page = "/3g/mmzs/parking-44.jsp";
				}
				request.setAttribute("sonStoreId", args.getSonStoreId());
				request.setAttribute("sonStoreName", args.getSonStoreName());
				request.setAttribute("store", store);
				request.setAttribute("oldStore", oldStore);
			}
			
			if("200".equals(serviceJson.get("returnCode"))){
				try {
					request.getRequestDispatcher(page).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::compareCar::" + e.getMessage());
				}
			}else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::compareCar::" + e.getMessage());
				}
			}
		}
	}
	
	private void changeCar(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话已失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordNum", args.getInRecordNum());
			json.put("oldSonStoreId", args.getOldSonStoreId());
			json.put("sonStoreId", args.getSonStoreId());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
//			JSONObject result = serviceJson.getJSONObject("result");
			if(serviceJson != null && "200".equals(serviceJson.get("returnCode"))){
				args.setServiceCode("MMZS108");
				queryShed(args, response, request, httpSession);
			}else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}
		}
	}
	
	/**
	 * 车位信息查询
	 * @param args
	 * @param response
	 */
	private void queryInRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String sgAddrgs = productPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话已失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
	        //水果种类查询
	        JSONObject sgjson = new JSONObject();
	        sgjson.put("atUserId", atUserId);
		    StringBuffer sgbuff=new StringBuffer();
		    sgbuff.append(sgjson.toJSONString());
		    String sgbusiness = sgjson.toString();
	        // 创建参数队列    
		    Map<String, String> sgparams = new HashMap<String, String>();
		    sgparams.put("serviceCode", "3000P01");
		    sgparams.put("sign", sign);
		    sgparams.put("timestamp", timestamp);
		    sgparams.put("nonce", nonce);
		    sgparams.put("editUserId", editUserId);
		    sgparams.put("editTime", editTime);
		    sgparams.put("ipaddr", ipaddr);
		    sgparams.put("device", device);
		    sgparams.put("mac", mac);
			sgparams.put("realName", userlist.getRealName());
			sgparams.put("companyId", userlist.getCompanyId());
			sgparams.put("companyName", userlist.getCompanyName());
			sgparams.put("departmentId", userlist.getDepartmentId());
			sgparams.put("departmentName", userlist.getDepartmentName());
		    sgparams.put("business", sgbusiness);
	        String sgString = sendhttp(sgAddrgs, sgparams);
	        JSONObject sgJson=JSON.parseObject(sgString);
	        if("200".equals(sgJson.get("returnCode"))){
		        Object resultObject=sgJson.get("result");
	            String tokenString = "";
	            JSONArray tokenJson = null;
	            if(null != resultObject){
	            	tokenString=resultObject.toString();
	            	if("[]".equals(tokenString)){
	            		tokenJson = new JSONArray();
	            	}else{
	            		tokenJson=JSONArray.parseArray(tokenString);
	            	}
	            }
            	List<Goods> phs = new ArrayList<Goods>();
            	for(int i = 0, size = tokenJson.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) tokenJson.get(i);
            		Goods ph = JSONObject.toJavaObject(jsont, Goods.class);
            		if("水果".equals(EncodingTool.encodeStr(ph.getFather()))){
            			ph.setType("30");
            		}
            		if("蔬菜".equals(EncodingTool.encodeStr(ph.getFather()))){
            			ph.setType("20");
            		}
            		phs.add(ph);
            	}
            	logger.info("get goods, size :" + phs.size());
            	request.setAttribute("goods", phs);
            }else{
            	try {
					request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryInRecord::" + e.getMessage());
				}
            }
	        String costType = args.getCostType();
	        if(StringUtils.isEmpty(costType)) {
	        	costType = "10";
	        }
	        
	        //车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("storeId", args.getStoreId());
		    json.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
		    json.put("sonStoreId", args.getSonStoreId());
		    json.put("sonStoreName", EncodingTool.encodeStr(args.getSonStoreName()));
		    json.put("parkState", args.getParkState());
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	JSONObject js = serviceJson.getJSONObject("result");
            	if(js != null && js.containsKey("costType")) {
            		costType = js.getString("costType");
            	}
            	try {
            		request.setAttribute("cp", js);
        	        String page = "";
        	        if("10".equals(costType)) {
        	        	page = "/3g/mmzs/parking-2.jsp";
        	        } else if("30".equals(costType)) {
        	        	page = "/3g/mmzs/parking-22.jsp";
        	        } else if("40".equals(costType)) {
        	        	page = "/3g/mmzs/parking-23.jsp";
        	        }
					request.getRequestDispatcher(page).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 缴费信息查询
	 * @param args
	 * @param response
	 */
	private void queryFeeRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
	        //车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordNum", args.getInRecordNum());
		    json.put("storeId", args.getStoreId());
		    json.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
		    json.put("sonStoreId", args.getSonStoreId());
		    json.put("sonStoreName", EncodingTool.encodeStr(args.getSonStoreName()));
		    json.put("queryType", args.getQueryType());
		    json.put("payType", args.getPayType());
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	JSONObject js = serviceJson.getJSONObject("result");
            	try {
            		String costType = js.getString("costType");
            		request.setAttribute("cp", js);
            		request.setAttribute("queryType", args.getQueryType());
            		String page = "/3g/mmzs/vehicle-5.jsp";
            		if("30".equals(costType)) {
            			page = "/3g/mmzs/vehicle-55.jsp";
            		} else if("40".equals(costType)) {
            			page = "/3g/mmzs/vehicle-56.jsp";
            		}
            		if("4".equals(args.getQueryType())) {
            			page = "/3g/mmzs/vehicle-6.jsp";
                		if("30".equals(costType)) {
                			page = "/3g/mmzs/vehicle-66.jsp";
                		}
            		}
					request.getRequestDispatcher(page).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=MMZS120&queryType=" + args.getQueryType());
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }
		}
	}
	
	private void queryFeeRecordForPrint(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			//车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordNum", args.getInRecordNum());
			json.put("storeId", args.getStoreId());
			json.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
			json.put("sonStoreId", args.getSonStoreId());
			json.put("sonStoreName", EncodingTool.encodeStr(args.getSonStoreName()));
			json.put("queryType", args.getQueryType());
			json.put("payType", args.getPayType());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "MMZS112");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				JSONObject js = serviceJson.getJSONObject("result");
				try {
					request.setAttribute("cp", js);
					request.setAttribute("queryType", args.getQueryType());
					String page = "/3g/mmzs/print.jsp";
					request.getRequestDispatcher(page).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("remsg", remsg);
					response.sendRedirect("/3g/mmzs/yuexi.jsp");
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}
		}
	}
	
	/**
	 * 添加车位信息
	 * @param args
	 * @param response
	 */
	private void insertInRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
	        //添加车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordNum", args.getInRecordNum());
		    json.put("storeId", args.getStoreId());
		    json.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
		    json.put("sonStoreId", args.getSonStoreId());
		    json.put("sonStoreName", EncodingTool.encodeStr(args.getSonStoreName()));
		    json.put("parkState", args.getParkState());
		    json.put("plateNum", EncodingTool.encodeStr(args.getPlateNum()));
		    json.put("carType", EncodingTool.encodeStr(args.getCarType()));
		    json.put("weightType", EncodingTool.encodeStr(args.getWeightType()));
		    json.put("costType", args.getCostType());//10:经营管理费, 30:短租收费//20:超时费用, 这里是进场单录入界面, 不会出现20的情形
		    json.put("rate", args.getRate());
		    json.put("count", args.getCount());
		    json.put("costs", args.getCosts());
		    json.put("benefit", args.getBenefit());
		    json.put("payment", args.getPayment());
		    json.put("goodsKingdom", EncodingTool.encodeStr(args.getGoodsKingdom()));
		    json.put("goodsInfo", EncodingTool.encodeStr(args.getGoodsInfo()));
		    json.put("remark", EncodingTool.encodeStr(args.getRemark()));
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=MMZS108");
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 添加离场信息
	 * @param args
	 * @param response
	 */
	private void insertOutRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTimeMillions();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请联系管理员!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			//添加车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordNum", args.getInRecordNum());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				try {
					response.sendRedirect("/wape-web/api/core/centerService?serviceCode=MMZS108");
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/parking.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryShed::" + e.getMessage());
				}
			}
		}
	}
	
	/**
	 * 收货收费列表信息
	 * @param args
	 * @param response
	 */
	private void queryWaitPayRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			String queryType = args.getQueryType();
			if(StringUtils.isEmpty(queryType)) {
				queryType = "1";
			}
			String queryFlag = args.getQueryFlag();
			String queryHour = args.getQueryHour();
			
			String directPage = "/3g/mmzs/vehicle.jsp";
			if("1".equals(queryType)){  //待缴费
				directPage = "/3g/mmzs/vehicle.jsp";
			}else if("2".equals(queryType)){
				directPage = "/3g/mmzs/vehicle-2.jsp";
			}else if("3".equals(queryType)){
				directPage = "/3g/mmzs/vehicle-3.jsp";
			}else if("4".equals(queryType)){
				directPage = "/3g/mmzs/vehicle-4.jsp";
			}
			
	        //添加车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("queryType", queryType);
		    json.put("queryFlag", queryFlag);
		    json.put("queryHour", queryHour);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
    	        JSONArray array = serviceJson.getJSONArray("result");
            	try {
            		JSONObject jo1;
            		JSONArray ja1;
            		
            		List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
            		for(int i =0, size = array.size(); i < size; i++){
            			jo1 = array.getJSONObject(i);
            			String dateStr = jo1.getString("date");
            			FeeCount fc = new FeeCount();
            			fc.setDateStr(dateStr);
            			ja1 = jo1.getJSONArray("list");
            			int count = 0;
            			Integer fee = 0;
            			Integer acceFee = 0;
            			Integer waitFee = 0;
            			for(int j = 0, jsize = ja1.size(); j < jsize; j++){
            				CarPack cp = JSONObject.toJavaObject(ja1.getJSONObject(j), CarPack.class);
            				if(!"2".equals(cp.getPayType())) {
	            				count++;
	            				Integer bd = Integer.valueOf(cp.getPayment());
	            				fee += bd;
	            				if("1".equals(cp.getPayType())) {
	            					acceFee += bd;
	            				} else {
	            					waitFee += bd;
	            				}
            				}
            			}
            			fc.setCountCar(String.valueOf(count));
            			fc.setCountFee(fee + "");
            			fc.setAcceFee(acceFee + "");
            			fc.setWaitFee(waitFee + "");
            			Map<String, Object> rlm = new HashMap<String, Object>();
            			rlm.put("feeCount", fc);
            			rlm.put("list", ja1);
            			
            			resultList.add(rlm);
            		}
            		request.setAttribute("list", resultList);
            		request.setAttribute("queryFlag", queryFlag);
            		request.setAttribute("queryHour", queryHour);
            		
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryWaitPayRecord::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryWaitPayRecord::" + e.getMessage());
				}
            }
		}
	}
	
	private void query24HourPayRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			String queryType = args.getQueryType();
			String queryFlag = args.getQueryFlag();
			String queryHour = args.getQueryHour();

			if(StringUtils.isEmpty(queryType)) {
				queryType = "3";
			}
			String directPage = "/3g/mmzs/vehicle-3.jsp";
			
			//添加车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("queryType", queryType);
			json.put("queryFlag", queryFlag);
			json.put("queryHour", queryHour);
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				JSONArray array = serviceJson.getJSONArray("result");
				try {
					JSONObject js1;
					JSONArray ja1;
					List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
					
					for(int i =0, size = array.size(); i < size; i++){
						js1 = array.getJSONObject(i);
						String dateStr = js1.getString("date");
						FeeCount fc = new FeeCount();
						fc.setDateStr(dateStr);
						ja1 = js1.getJSONArray("list");

						int count = 0;
						Integer fee = 0;
						Integer acceFee = 0;
						Integer waitFee = 0;
						for(int j = 0, jsize = ja1.size(); j < jsize; j++){
							CarPack cp = JSONObject.toJavaObject(ja1.getJSONObject(j), CarPack.class);
							if(!"2".equals(cp.getPayType())) {
								count++;
								Integer bd = Integer.valueOf(cp.getPayment());
								fee += bd;
								if("1".equals(cp.getPayType())) {
									acceFee += bd;
								} else {
									waitFee += bd;
								}
							}
						}
						fc.setCountCar(String.valueOf(count));
						fc.setCountFee(fee + "");
						fc.setAcceFee(acceFee + "");
						fc.setWaitFee(waitFee + "");
						
						Map<String, Object> rlm = new HashMap<String, Object>();
						rlm.put("feeCount", fc);
						rlm.put("list", ja1);
						
						resultList.add(rlm);
					}
					
					request.setAttribute("list", resultList);
					request.setAttribute("queryFlag", queryFlag);
					request.setAttribute("queryHour", queryHour);
					
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord::" + e.getMessage());
				}
			}else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("remsg", remsg);
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord::" + e.getMessage());
				}
			}
		}
	}
	
	private void generate24HourPayReport(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
			String queryType = args.getQueryType();
			String queryFlag = args.getQueryFlag();
			String queryHour = args.getQueryHour();
			String selectedChargesIds = args.getSelectedChargesIds();
			
			if(StringUtils.isEmpty(queryType)) {
				queryType = "3";
			}
			
			//添加车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("selectedChargesIds", selectedChargesIds);
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				args.setServiceCode("MMZS122");
				args.setQueryType(null);
				args.setQueryHour(null);
				args.setQueryFlag("1");
				query24HourPayRecord(args, response, request, httpSession);
			}else{
				String remsg = "";
				remsg = serviceJson.getString("returnMsg");
				if(StringUtils.isEmpty(remsg)) {
					remsg = "系统错误, 请联系管理员!";
				}
				try {
					request.setAttribute("queryType", queryType);
					request.setAttribute("queryFlag", queryFlag);
					request.setAttribute("queryHour", queryHour);
					request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/vehicle-3.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord::" + e.getMessage());
				}
			}
		}
	}
	
	private void query24HourPayReport(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::query24HourPayReport::userlist is null" + e.getMessage());
			}
		}else{
			
			//添加车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				
				JSONArray array = serviceJson.getJSONArray("result");
				try {
					JSONObject js1;
					JSONArray ja1;
					List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
					
					for(int i =0, size = array.size(); i < size; i++){
						js1 = array.getJSONObject(i);
						String dateStr = js1.getString("date");
						FeeCount fc = new FeeCount();
						fc.setDateStr(dateStr);
						ja1 = js1.getJSONArray("list");
						int count = 0;
						Integer fee = 0;
						for(int j = 0, jsize = ja1.size(); j < jsize; j++){
							CarPack cp = JSONObject.toJavaObject(ja1.getJSONObject(j), CarPack.class);
							count++;
							Integer bd = Integer.valueOf(cp.getTotalPayment());
							fee += bd;
						}
						fc.setCountCar(String.valueOf(count));
						fc.setCountFee(fee + "");
						
						Map<String, Object> rlm = new HashMap<String, Object>();
						rlm.put("feeCount", fc);
						rlm.put("list", ja1);
						resultList.add(rlm);
					}
					request.setAttribute("list", resultList);

					String directPage = "/3g/mmzs/chargesreport-1.jsp";
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayReport::" + e.getMessage());
				}
			}else{
				String remsg = "";
				remsg = serviceJson.getString("returnMsg");
				if(StringUtils.isEmpty(remsg)) {
					remsg = "系统错误, 请联系管理员!";
				}
				try {
					request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/yuexi.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord::" + e.getMessage());
				}
			}
		}
	}
	
	private void queryReportListByTime(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryReportList::userlist is null" + e.getMessage());
			}
		}else{
			String chargesClazz = args.getChargesClazz();
			String chargerName = EncodingTool.encodeStr(args.getChargerName());
			request.setAttribute("chargesClazz", chargesClazz);
			request.setAttribute("chargerName", chargerName);
			//添加车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("chargesClazz", chargesClazz);
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				JSONArray array = serviceJson.getJSONArray("result");
				try {
					JSONObject js1;
					JSONArray ja1;
					List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
					//按时间加载
					for(int i =0, size = array.size(); i < size; i++){
						js1 = array.getJSONObject(i);
						String dateStr = js1.getString("date");
						FeeCount fc = new FeeCount();
						fc.setDateStr(dateStr);;
						ja1 = js1.getJSONArray("list");
						int count = 0;
						Integer fee = 0;
						Integer acceFee = 0;
						Integer waitFee = 0;
						for(int j = 0, jsize = ja1.size(); j < jsize; j++){
							CarPack cp = JSONObject.toJavaObject(ja1.getJSONObject(j), CarPack.class);
							if(!"2".equals(cp.getPayType())) {
								count++;
								Integer bd = Integer.valueOf(cp.getPayment());
								fee += bd;
								if("1".equals(cp.getPayType())) {
									acceFee += bd;
								} else {
									waitFee += bd;
								}
							}
						}
						fc.setCountCar(String.valueOf(count));
						fc.setCountFee(fee + "");
						fc.setAcceFee(acceFee + "");
						fc.setWaitFee(waitFee + "");
						
						Map<String, Object> rlm = new HashMap<String, Object>();
						rlm.put("feeCount", fc);
						rlm.put("list", ja1);
						resultList.add(rlm);
					}
					request.setAttribute("list", resultList);
					request.getRequestDispatcher("/3g/mmzs/chargesreport-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord by time::" + e.getMessage());
				}
			}else{
				String returnMsg = "系统错误, 请联系管理员!";	
				returnMsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("returnMsg", returnMsg);
					request.getRequestDispatcher("/3g/mmzs/chargesreport-1.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::query24HourPayRecord by time::" + e.getMessage());
				}
			}
		}
	}
	
	private void queryReportListByType(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryReportList::userlist is null" + e.getMessage());
			}
		}else{
			/**
			 * 1.查出三天内的所有报告
				2.查出三天内的所有缴费记录
				3.将报告按日期分类
				4.筛选出当天报告所对应的缴费记录
				5.汇总当天缴费记录并按费用类型分类
			 */
			String chargesClazz = args.getChargesClazz();
			String chargerName = EncodingTool.encodeStr(args.getChargerName());
			request.setAttribute("chargesClazz", chargesClazz);
			request.setAttribute("chargerName", chargerName);
			//1
			JSONArray array1 = new JSONArray();
			JSONObject json1 = new JSONObject();
			json1.put("atUserId", atUserId);
			StringBuffer buff1=new StringBuffer();
			buff1.append(json1.toJSONString());
			String business1 = json1.toString();
			Map<String, String> params1 = new HashMap<String, String>();
			params1.put("serviceCode", "MMZS124");
			params1.put("sign", sign);
			params1.put("timestamp", timestamp);
			params1.put("nonce", nonce);
			params1.put("editUserId", editUserId);
			params1.put("editTime", editTime);
			params1.put("ipaddr", ipaddr);
			params1.put("device", device);
			params1.put("mac", mac);
			params1.put("realName", userlist.getRealName());
			params1.put("companyId", userlist.getCompanyId());
			params1.put("companyName", userlist.getCompanyName());
			params1.put("departmentId", userlist.getDepartmentId());
			params1.put("departmentName", userlist.getDepartmentName());
			params1.put("business", business1);
			String serviceString1 = sendhttp(serviceAddrgs, params1);
			JSONObject serviceJson1=JSON.parseObject(serviceString1);
			if("200".equals(serviceJson1.get("returnCode"))){
				array1 = serviceJson1.getJSONArray("result");
			}
			//2
//			JSONArray array = new JSONArray();
//			JSONObject json = new JSONObject();
//			List<ChargesManagement> cmlist = new ArrayList<ChargesManagement>();
//			json.put("atUserId", atUserId);
//			json.put("query3Day", "query3Day");
//			StringBuffer buff=new StringBuffer();
//			buff.append(json.toJSONString());
//			String business = json.toString();
//			Map<String, String> params = new HashMap<String, String>();
//			params.put("serviceCode", "MMZS122");
//			params.put("sign", sign);
//			params.put("timestamp", timestamp);
//			params.put("nonce", nonce);
//			params.put("editUserId", editUserId);
//			params.put("editTime", editTime);
//			params.put("ipaddr", ipaddr);
//			params.put("device", device);
//			params.put("mac", mac);
//			params.put("realName", userlist.getRealName());	
//			params.put("companyId", userlist.getCompanyId());
//			params.put("companyName", userlist.getCompanyName());
//			params.put("departmentId", userlist.getDepartmentId());
//			params.put("departmentName", userlist.getDepartmentName());
//			params.put("business", business);
//			String serviceString = sendhttp(serviceAddrgs, params);
//			JSONObject serviceJson=JSON.parseObject(serviceString);
//			if("200".equals(serviceJson.get("returnCode"))){
//				array = serviceJson.getJSONArray("result");
//				//处理json，将所有记录存到一个集合中，方便后续遍历
//				for(int t = 0, tsize = array.size();t < tsize; t++){
//					JSONObject tobj = new JSONObject(array.getJSONObject(t));
//					JSONArray tarr = tobj.getJSONArray("list");
//					for(int w=0,wsize=tarr.size();w < wsize;w++){
//						cmlist.add(JSON.toJavaObject(tarr.getJSONObject(w), ChargesManagement.class));
//					}
//				}
//			}
			//3
			JSONObject js1;
			JSONArray ja1;
			List<FeeCount> fec = new ArrayList<FeeCount>();
			List<FeeReportBody> fja = new ArrayList<FeeReportBody>();
			List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
			//遍历所有报告
			for(int i =0, size = array1.size(); i < size; i++){
				js1 = array1.getJSONObject(i);
				String dateStr = js1.getString("date");
				FeeCount fc = new FeeCount();
				fc.setDateStr(dateStr);
				ja1 = js1.getJSONArray("list");
				int count = 0;
				Integer fee = 0;
				String[] sar = new String[ja1.size()];
				//遍历一天的报告
				for(int j = 0, jsize = ja1.size(); j < jsize; j++){
					CarPack cp = JSONObject.toJavaObject(ja1.getJSONObject(j), CarPack.class);
					sar[j] = cp.getChargesClazz();
//					count++;
					Integer bd = Integer.valueOf(cp.getTotalPayment());
					fee += bd;
					//4找到报告所对应的缴费记录
//					FeeReportBody frb1 = new FeeReportBody(); // 经营费
//					FeeReportBody frb2 = new FeeReportBody(); //超时费
//					FeeReportBody frb3 = new FeeReportBody(); //短租费
//					int ccount1 = 0;
//					int cfee1 = 0;
//					int ccount2 = 0;
//					int cfee2 = 0;
//					int ccount3 = 0;
//					int cfee3 = 0;
					//遍历所有缴费记录
//					for(int k = 0,ksize=cmlist.size();k < ksize; k++){
//						ChargesManagement cm = cmlist.get(k);
//						if(StringUtils.isEmpty(cm.getChargesClazz())){
//							continue;
//						}
//						if(cp.getChargesClazz().equals(cm.getChargesClazz())){ //报告下的缴费记录
//							count++;
//							if("10".equals(cm.getCostType())){
//								ccount1++;
//								cfee1+= Integer.parseInt(cm.getPayment());
//							}else if("20".equals(cm.getCostType())){
//								ccount2++;
//								cfee2 += Integer.parseInt(cm.getPayment());
//							}else if("30".equals(cm.getCostType())){
//								ccount3++;
//								cfee3 += Integer.parseInt(cm.getPayment());
//							}else if("40".equals(cm.getCostType())){
//								ccount3++;
//								cfee3 += Integer.parseInt(cm.getPayment());
//							}
//						}
//					}
//					if(ccount1 != 0){
//						frb1.setDateStr(dateStr);
//						frb1.setFeeType("10");
//						frb1.setFeeCount(String.valueOf(cfee1));
//						frb1.setPageCount(String.valueOf(ccount1));
//						fja.add(frb1);
//					}
//					if(ccount2 != 0){
//						frb2.setDateStr(dateStr);
//						frb2.setFeeType("20");
//						frb2.setFeeCount(String.valueOf(cfee2));
//						frb2.setPageCount(String.valueOf(ccount2));
//						fja.add(frb2);
//					}
//					if(ccount3 != 0){
//						frb3.setDateStr(dateStr);
//						frb3.setFeeType("30");
//						frb3.setFeeCount(String.valueOf(cfee3));
//						frb3.setPageCount(String.valueOf(ccount3));
//						fja.add(frb3);
//					}
				}
				//查询一天报告的缴费记录
				//2
				JSONArray array = new JSONArray();
				JSONObject json = new JSONObject();
				List<ChargesManagement> cmlist = new ArrayList<ChargesManagement>();
				json.put("atUserId", atUserId);
				json.put("chargesClazz", sar);
				StringBuffer buff=new StringBuffer();
				buff.append(json.toJSONString());
				String business = json.toString();
				Map<String, String> params = new HashMap<String, String>();
				params.put("serviceCode", "MMZS131");
				params.put("sign", sign);
				params.put("timestamp", timestamp);
				params.put("nonce", nonce);
				params.put("editUserId", editUserId);
				params.put("editTime", editTime);
				params.put("ipaddr", ipaddr);
				params.put("device", device);
				params.put("mac", mac);
				params.put("realName", userlist.getRealName());	
				params.put("companyId", userlist.getCompanyId());
				params.put("companyName", userlist.getCompanyName());
				params.put("departmentId", userlist.getDepartmentId());
				params.put("departmentName", userlist.getDepartmentName());
				params.put("business", business);
				String serviceString = sendhttp(serviceAddrgs, params);
				JSONObject serviceJson=JSON.parseObject(serviceString);
				JSONArray czArr = serviceJson.getJSONArray("result");
				//4找到报告所对应的缴费记录
				FeeReportBody frb1 = new FeeReportBody(); // 经营费
				FeeReportBody frb2 = new FeeReportBody(); //超时费
				FeeReportBody frb3 = new FeeReportBody(); //短租费
				int ccount1 = 0;
				int cfee1 = 0;
				int ccount2 = 0;
				int cfee2 = 0;
				int ccount3 = 0;
				int cfee3 = 0;
				//遍历所有缴费记录
				for(int k = 0,ksize=czArr.size();k < ksize; k++){
					ChargesManagement cm = JSON.toJavaObject(czArr.getJSONObject(k), ChargesManagement.class);
					count++;
					if("10".equals(cm.getCostType())){
						ccount1++;
						cfee1+= Integer.parseInt(cm.getPayment());
					}else if("20".equals(cm.getCostType())){
						ccount2++;
						cfee2 += Integer.parseInt(cm.getPayment());
					}else if("30".equals(cm.getCostType())){
						ccount3++;
						cfee3 += Integer.parseInt(cm.getPayment());
					}else if("40".equals(cm.getCostType())){
						ccount3++;
						cfee3 += Integer.parseInt(cm.getPayment());
					}
				}
				if(ccount1 != 0){
					frb1.setDateStr(dateStr);
					frb1.setChargesClazz(Arrays.toString(sar));
					frb1.setFeeType("10");
					frb1.setFeeCount(String.valueOf(cfee1));
					frb1.setPageCount(String.valueOf(ccount1));
					fja.add(frb1);
				}
				if(ccount2 != 0){
					frb2.setDateStr(dateStr);
					frb2.setChargesClazz(Arrays.toString(sar));
					frb2.setFeeType("20");
					frb2.setFeeCount(String.valueOf(cfee2));
					frb2.setPageCount(String.valueOf(ccount2));
					fja.add(frb2);
				}
				if(ccount3 != 0){
					frb3.setDateStr(dateStr);
					frb3.setChargesClazz(Arrays.toString(sar));
					frb3.setFeeType("30");
					frb3.setFeeCount(String.valueOf(cfee3));
					frb3.setPageCount(String.valueOf(ccount3));
					fja.add(frb3);
				}
				
				fc.setCountCar(String.valueOf(count)); //不能用报告数，而是缴费记录数
				fc.setCountFee(fee + "");
				fec.add(fc);
//				Map<String, Object> rlm = new HashMap<String, Object>();
//				rlm.put("feeCount", fc);
				//将此list改变成所有缴费记录的汇总即可
//				rlm.put("list", fja);
//				resultList.add(rlm);
			}
			request.setAttribute("fec", fec);
			request.setAttribute("list", fja);
			try {
				request.getRequestDispatcher("/3g/mmzs/chargesreport-11.jsp").forward(request, response);
			} catch (Exception e) {
				e.printStackTrace();
			}
	
		}
	}
	
	private void queryReportDetailByType(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryReportDetailByType::userlist is null" + e.getMessage());
			}
		}else{
			String chargesClazz = args.getChargesClazz();
			String chargerName = EncodingTool.encodeStr(args.getChargerName());
			request.setAttribute("chargesClazz", chargesClazz);
			request.setAttribute("chargerName", chargerName);
			String costType = args.getCostType();
			String chargesDay = args.getChargesDay();
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("costType", costType);
			json.put("chargesClazz", chargesClazz);
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "MMZS130");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				JSONArray array = serviceJson.getJSONArray("result");
				try {
					List<ChargesManagement> list = new ArrayList<ChargesManagement>();
					int ccount = 0;
					int cfee = 0;
					for(int i = 0,size = array.size(); i < size; i++){
						ChargesManagement cm = JSON.toJavaObject(array.getJSONObject(i), ChargesManagement.class);
						if(StringUtils.isEmpty(cm.getChargesClazz())){
							continue;
						}
						list.add(cm);
						ccount++;
						cfee += Integer.parseInt(cm.getPayment());
					}
					request.setAttribute("day", chargesDay);
					request.setAttribute("count", ccount);
					request.setAttribute("fee", cfee);
					request.setAttribute("list", list);
					request.getRequestDispatcher("/3g/mmzs/chargesreport-22.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryReportDetailByType by type::" + e.getMessage());
				}
			}else{
				String returnMsg = "系统错误, 请联系管理员!";	
				returnMsg = serviceJson.getString("returnMsg");
				try {
					request.setAttribute("returnMsg", returnMsg);
					request.getRequestDispatcher("/3g/mmzs/chargesreport-22.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryReportDetailByType by type::" + e.getMessage());
				}
			}
		}
	}
	
	private void queryEditRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryEditRecord::userlist is null" + e.getMessage());
			}
		}else{
			String inRecordNum = args.getInRecordNum();
			String plateNum = args.getPlateNum();
			String carType = args.getCarType();
			String weightType = args.getWeightType();
			String storeName = args.getStoreName();
			String sonStoreName = args.getSonStoreName();
			String goodsKingdom = args.getGoodsKingdom();
			String goodsInfo = args.getGoodsInfo();
			
			String directPage = "/3g/mmzs/list_vehicle.jsp";
			
	        //添加车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("inRecordNum", inRecordNum);
		    json.put("plateNum", plateNum);
		    json.put("carType", carType);
		    json.put("weightType", weightType);
		    json.put("storeName", storeName);
		    json.put("sonStoreName", sonStoreName);
		    json.put("goodsKingdom", goodsKingdom);
		    json.put("goodsInfo", goodsInfo);
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
    	        JSONArray array = serviceJson.getJSONArray("result");
            	try {
            		JSONObject js1;
            		JSONArray ja1;
            		List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
            		
            		for(int i =0, size = array.size(); i < size; i++){
            			js1 = array.getJSONObject(i);
            			String dateStr = js1.getString("date");
            			FeeCount fc = new FeeCount();
            			fc.setDateStr(dateStr);;
            			ja1 = js1.getJSONArray("list");
            			
            			Map<String, Object> rlm = new HashMap<String, Object>();
            			rlm.put("feeCount", fc);
            			rlm.put("list", ja1);
            		}
            		request.setAttribute("list", resultList);
            		
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryEditRecord::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher(directPage).forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryEditRecord::" + e.getMessage());
				}
            }
		}
	}
	
	private void querySingleEditRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String sgAddrgs = productPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::querySingleEditRecord::userlist is null" + e.getMessage());
			}
		}else{
			//水果种类查询
	        JSONObject sgjson = new JSONObject();
	        sgjson.put("atUserId", atUserId);
	        sgjson.put("goodsKingdom", "粤西常见水果");
		    StringBuffer sgbuff=new StringBuffer();
		    sgbuff.append(sgjson.toJSONString());
		    String sgbusiness = sgjson.toString();
	        // 创建参数队列    
		    Map<String, String> sgparams = new HashMap<String, String>();
		    sgparams.put("serviceCode", "3000P01");
		    sgparams.put("sign", sign);
		    sgparams.put("timestamp", timestamp);
		    sgparams.put("nonce", nonce);
		    sgparams.put("editUserId", editUserId);
		    sgparams.put("editTime", editTime);
		    sgparams.put("ipaddr", ipaddr);
		    sgparams.put("device", device);
		    sgparams.put("mac", mac);
			sgparams.put("realName", userlist.getRealName());
			sgparams.put("companyId", userlist.getCompanyId());
			sgparams.put("companyName", userlist.getCompanyName());
			sgparams.put("departmentId", userlist.getDepartmentId());
			sgparams.put("departmentName", userlist.getDepartmentName());
		    sgparams.put("business", sgbusiness);
	        String sgString = sendhttp(sgAddrgs, sgparams);
	        JSONObject sgJson=JSON.parseObject(sgString);
	        Object resultObject=sgJson.get("result");
            String tokenString = "";
            JSONArray tokenJson = null;
            if(null != resultObject){
            	tokenString=resultObject.toString();
            	if("[]".equals(tokenString)){
            		tokenJson = new JSONArray();
            	}else{
            		tokenJson=JSONArray.parseArray(tokenString);
            	}
            }
	        if("200".equals(sgJson.get("returnCode"))){
            	List<Goods> phs = new ArrayList<Goods>();
            	for(int i = 0, size = tokenJson.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) tokenJson.get(i);
            		Goods ph = JSONObject.toJavaObject(jsont, Goods.class);
            		phs.add(ph);
            	}
            	logger.info("get goods, size :" + phs.size());
            	request.setAttribute("goods", phs);
            }else{
            	try {
					request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::queryInRecord::" + e.getMessage());
				}
            }
			
	        //车位信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordKey", args.getInRecordKey());
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	JSONObject js = serviceJson.getJSONObject("result");
        		request.setAttribute("cp", js);
            	try {
            		request.getRequestDispatcher("/3g/mmzs/edit_vehicle.jsp").forward(request, response);
    			} catch (Exception e) {
    				logger.info("wape-web::querySingleEditRecord::" + e.getMessage());
    			}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
        		request.setAttribute("remsg", remsg);
            	try {
            		request.getRequestDispatcher("/3g/mmzs/query_vehicle.jsp").forward(request, response);
    			} catch (Exception e) {
    				logger.info("wape-web::querySingleEditRecord::" + e.getMessage());
    			}
            }
		}
	}
	
	private void editSingleRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::editSingleRecord::userlist is null" + e.getMessage());
			}
		}else{
			//车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordKey", args.getInRecordKey());
			json.put("inRecordNum", args.getInRecordNum());
			json.put("plateNum", EncodingTool.encodeStr(args.getPlateNum()));
			json.put("carType", EncodingTool.encodeStr(args.getCarType()));
		    json.put("weightType", EncodingTool.encodeStr(args.getWeightType()));
		    json.put("goodsKingdom", EncodingTool.encodeStr(args.getGoodsKingdom()));
		    json.put("goodsInfo", EncodingTool.encodeStr(args.getGoodsInfo()));
		    json.put("rate", args.getRate());
		    json.put("count", args.getCount());
		    json.put("costs", args.getCosts());
		    json.put("benefit", args.getBenefit());
		    json.put("payment", args.getPayment());
		    
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if("200".equals(serviceJson.get("returnCode"))){
				JSONObject js = serviceJson.getJSONObject("result");
				request.setAttribute("cp", js);
			}else{
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				request.setAttribute("remsg", remsg);
			}
			try {
				request.getRequestDispatcher("/3g/mmzs/query_vehicle.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::editSingleRecord::" + e.getMessage());
			}
		}
	}
	
	private void removeRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
		String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
		String editUserId = atUserId;
		String editTime = Utils.getCurrTime();
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
		String device = "pc";
		String mac = "00-00-00-00-000";
		
		UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
			String remsg = "用户会话失效, 请重新登录!";
			try {
				request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::removeRecord::userlist is null" + e.getMessage());
			}
		}else{
			//车位信息
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("inRecordKey", args.getInRecordKey());
			StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
			String business = json.toString();
			// 创建参数队列    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
			if(!"200".equals(serviceJson.get("returnCode"))){
				String remsg = "系统错误, 请联系管理员!";
				remsg = serviceJson.getString("returnMsg");
				request.setAttribute("remsg", remsg);
			}
			args.setServiceCode("MMZS108");
			queryShed(args, response, request, httpSession);
		}
	}
	
	/**
	 * 添加收费信息
	 * @param args
	 * @param response
	 */
	private void insertChargeRecord(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCode = args.getServiceCode();
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
	    UserList userlist =(UserList) httpSession.getAttribute("user");
		
		if(null == userlist){//用户未登陆
        	String remsg = "用户会话失效, 请重新登录!";
        	try {
        		request.setAttribute("remsg", remsg);
				request.getRequestDispatcher("/3g/login.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::queryShed::userlist is null" + e.getMessage());
			}
		}else{
	        //添加缴费信息
	        JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("queryType", args.getQueryType());
		    json.put("storeId", args.getStoreId());
		    json.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
		    json.put("sonStoreId", EncodingTool.encodeStr(args.getSonStoreId()));
		    json.put("sonStoreName", EncodingTool.encodeStr(args.getSonStoreName()));
		    json.put("parkState", EncodingTool.encodeStr( args.getParkState()));
		    json.put("inRecordNum", args.getInRecordNum());
		    json.put("plateNum", EncodingTool.encodeStr(args.getPlateNum()));
		    json.put("carType", EncodingTool.encodeStr(args.getCarType()));
		    json.put("weightType", EncodingTool.encodeStr(args.getWeightType()));
		    json.put("rate", args.getRate());
		    json.put("count", args.getCount());
		    json.put("costs", args.getCosts());
		    json.put("benefit", args.getBenefit());
		    json.put("payment", args.getPayment());
		    json.put("goodsKingdom", EncodingTool.encodeStr(args.getGoodsKingdom()));
		    json.put("goodsInfo", EncodingTool.encodeStr(args.getGoodsInfo()));
		    json.put("departmentId", args.getDpId());
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCode);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", userlist.getRealName());
			params.put("companyId", userlist.getCompanyId());
			params.put("companyName", userlist.getCompanyName());
			params.put("departmentId", userlist.getDepartmentId());
			params.put("departmentName", userlist.getDepartmentName());
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            if("200".equals(serviceJson.get("returnCode"))){
            	try {
            		response.sendRedirect("/wape-web/api/core/centerService?serviceCode=MMZS112&queryType="+args.getQueryType());
				} catch (Exception e) {
					logger.info("wape-web::insertChargeRecord::" + e.getMessage());
				}
            }else{
            	String remsg = "系统错误, 请联系管理员!";
            	remsg = serviceJson.getString("returnMsg");
            	try {
            		request.setAttribute("remsg", remsg);
					request.getRequestDispatcher("/3g/mmzs/parking-2.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::insertChargeRecord::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 加入公司第一步
	 * @param args
	 * @param response
	 */
	private void joinCompanyOne(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String locMeth = "joinCompanyOne";
		String serviceAddrgs = authPath;
		String queryCompanyId = args.getCompanyId();
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    CompanyList company;
		JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
		json.put("companyId", queryCompanyId);
	    String businessgs = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCodegs);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", businessgs);
		logger.info(preModular + "::" + locMeth + ":: query company info business::" + businessgs);
		String serviceString = sendhttp(serviceAddrgs, params);
		logger.info(preModular + "::" + locMeth + ":: query company info return::" + serviceString);
		JSONObject serviceJson=JSON.parseObject(serviceString);
        JSONObject resultObject=(JSONObject) serviceJson.get("result");
        company = JSON.toJavaObject(resultObject, CompanyList.class);
		request.setAttribute("querycompany", company);
		if("200".equals(serviceJson.get("returnCode"))){
			String companyId=args.getCompanyId();
			JSONObject djson = new JSONObject();
			djson.put("atUserId", atUserId);
			djson.put("companyId", companyId);
			djson.put("haveEmp", "2");
			djson.put("haveJoin", "1");
		    String dbusinessgs = djson.toString();
			Map<String, String> dparams = new HashMap<String, String>();
			dparams.put("serviceCode", "5005U01");
			dparams.put("sign", sign);
			dparams.put("timestamp", timestamp);
			dparams.put("nonce", nonce);
			dparams.put("editUserId", editUserId);
			dparams.put("editTime", editTime);
			dparams.put("ipaddr", ipaddr);
			dparams.put("device", device);
			dparams.put("mac", mac);
			dparams.put("business", dbusinessgs);
			logger.info(preModular + "::" + locMeth + ":: query departments business::" + dbusinessgs);
			String dserviceString = sendhttp(serviceAddrgs, dparams);
			logger.info(preModular + "::" + locMeth + ":: query departments return::" + dserviceString);
			JSONObject dserviceJson=JSON.parseObject(dserviceString);
	        JSONObject dresultObject=(JSONObject) dserviceJson.get("result");
	        JSONArray array = JSONArray.parseArray(dresultObject.getString("departments"));
	        if("200".equals(serviceJson.get("returnCode"))){
	        	 List<CompanyDepartment> list = JSON.toJavaObject(array, List.class);
	        	 request.setAttribute("departs", list);
	        	 try {
					request.getRequestDispatcher("/3g/company/company-3.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info(preModular + "::" + locMeth + ":: send company-3 error::" + e.getMessage());
					try {
						request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
					} catch (Exception e1) {
						logger.info(preModular + "::" + locMeth + ":: send 404 error::" + e.getMessage());
					}
				}
	        }else{
	        	logger.info(preModular + "::" + locMeth + ":: query departments error::");
	        	try {
					request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info(preModular + "::" + locMeth + ":: send 404 error::" + e.getMessage());
				}
	        }
		}else{
			try {
				request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	/**
	 * 员工管理
	 * @param args
	 * @param response
	 */
	private void employeeManage(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String locMeth = "joinCompanyTwo";
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		UserList user=(UserList) httpSession.getAttribute("user");
		String serviceCodegs = "5005U01";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		String companyId=user.getCompanyId();
		String companyName=EncodingTool.encodeStr(user.getCompanyName());
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
			json.put("companyId", companyId);
			json.put("haveEmp", "1");
			json.put("haveJoin", "2");
		    String businessgs = json.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        JSONArray array = JSONArray.parseArray(resultObject.getString("departments"));
	        List<CompanyDepartment> list = JSON.toJavaObject(array, List.class);
	        JSONArray arraye = JSONArray.parseArray(resultObject.getString("employees"));
	        List<EmployeeInfo> liste = JSON.toJavaObject(arraye, List.class);
	        if("200".equals(serviceJson.get("returnCode"))){
	        	request.setAttribute("departs", list);
	        	request.setAttribute("emplyees", liste);
//	        	CompanyList querycompany = new CompanyList();
//	        	querycompany.setCompanyId(companyId);
//	        	querycompany.setCompanyName(companyName);
//	        	request.setAttribute("querycompany", querycompany);
				try {
					request.getRequestDispatcher("/3g/company/company-5.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::joinCompanyTwo::company is null" + e.getMessage());
				}
	        }else{
	        	try {
					request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
				} catch (Exception e) {
					e.printStackTrace();
				}
	        }
	}
	
	/**
	 * 人员审核
	 * @param args
	 * @param response
	 */
	private void joinAuditPass(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		UserList user = (UserList) httpSession.getAttribute("user");
		String ckDepartmentId = user.getDepartmentId();
		if(!StringUtils.isEmpty(ckDepartmentId)){
			if(!"200603".equals(ckDepartmentId)){
				rp.setReturnCode("500");
				rp.setReturnMsg("500");
				writeJsonToResponse(response, json.toJSON(rp).toString());
				return;
			}
		}
		String serviceCodegs = "5006U07";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTimeMillions();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
		String companyId=user.getCompanyId();
		String auditAtUserId = args.getAuditAtUserId();
		String departmentId = args.getDepartmentId();
		json.put("atUserId", atUserId);
		json.put("companyId", companyId);
		json.put("auditAtUserId", auditAtUserId);
		json.put("departmentId", departmentId);
	    String businessgs = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCodegs);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", businessgs);
		String serviceString = sendhttp(serviceAddrgs, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
		if("200".equals(serviceJson.get("returnCode"))){
			rp.setReturnCode("200");
			rp.setReturnMsg("200");
		}else{
			rp.setReturnCode("500");
			rp.setReturnMsg("500");
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 加入公司
	 * @param args
	 * @param response
	 */
	private void joinCompanyFinal(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		UserList user = (UserList) httpSession.getAttribute("user");
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String serviceCodegs = "5006U06";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		String companyId=args.getCompanyId();
		String companyName=EncodingTool.encodeStr(args.getCompanyName());
		String realName=user.getRealName();
		String departmentId=args.getDepartmentId();
		String departmentName=EncodingTool.encodeStr(args.getDepartmentName());
		JSONObject json = new JSONObject();
		json.put("atUserId", atUserId);
		json.put("companyId", companyId);
		json.put("companyName", companyName);
		json.put("realName", realName);
		json.put("departmentId", departmentId);
		json.put("departmentName", departmentName);
	    String businessgs = json.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", serviceCodegs);
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("business", businessgs);
		String serviceString = sendhttp(serviceAddrgs, params);
		JSONObject serviceJson=JSON.parseObject(serviceString);
		String returnCode = serviceJson.getString("returnCode");
		String returnMsg = serviceJson.getString("returnMsg");
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
        if("200".equals(returnCode)){
			try {
				request.getRequestDispatcher("/3g/company/company.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::joinCompanyFinal::company is null" + e.getMessage());
			}
        }else{
        	try {
				request.getRequestDispatcher("/3g/company/company-3.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::joinCompanyFinal::company is null" + e.getMessage());
			}
        }
	}
	
	/**
	 * 获取部门
	 * @param args
	 * @param response
	 */
	private void getCompanyDepart(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddr = productPath;
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		String token=(String) httpSession.getAttribute("token");
		String serviceCodegs = "5003U11";
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
	    String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("sign make error::" + e3.getMessage());
		}
	    String editUserId = atUserId;
	    String editTime = Utils.getCurrTime();
	    String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("ip not get::" + e2.getMessage());
		}
	    String device = "pc";
	    String mac = "00-00-00-00-000";
	    
		CompanyList company = null;
		String companyId=(String) httpSession.getAttribute("companyId");
		if(null == companyId){
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    String businessgs = json.toString();
		    
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", serviceCodegs);
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", businessgs);
			String serviceString = sendhttp(serviceAddrgs, params);
			JSONObject serviceJson=JSON.parseObject(serviceString);
	        JSONObject resultObject=(JSONObject) serviceJson.get("result");
	        company = JSON.toJavaObject(resultObject, CompanyList.class);
	        if(null != company){
	        	companyId = company.getCompanyId();
	        }
		}
		
		if(null == companyId){
			request.setAttribute("error", "W1001");
        	try {
				request.getRequestDispatcher("/3g/company/company.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::getCompanyDepart::company is null" + e.getMessage());
			}
		}else{
			JSONObject json = new JSONObject();
			json.put("atUserId", atUserId);
		    json.put("companyId", companyId);
		    json.put("haveEmp", "2");
		    json.put("haveJoin", "2");
		    StringBuffer buff=new StringBuffer();
			buff.append(json.toJSONString());
		    String business = json.toString();
	        // 创建参数队列    
		    Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "5005U01");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("business", business);
	        String serviceString = sendhttp(serviceAddrgs, params);
	        JSONObject serviceJson=JSON.parseObject(serviceString);
            String resultObject=serviceJson.getString("result");
            JSONObject dpsjson = JSON.parseObject(resultObject);
            JSONArray array = dpsjson.getJSONArray("departments");
            if("200".equals(serviceJson.get("returnCode"))){
            	List<CompanyDepartment> phs = new ArrayList<CompanyDepartment>();
            	for(int i = 0, size = array.size(); i < size; i++){
            		JSONObject jsont = (JSONObject) array.get(i);
            		CompanyDepartment ph = JSONObject.toJavaObject(jsont, CompanyDepartment.class);
            		phs.add(ph);
            	}
            	logger.info("get department, size :" + phs.size());
            	request.setAttribute("dps", phs);
            	try {
					request.getRequestDispatcher("/3g/company/management.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::getCompanyDepart::" + e.getMessage());
				}
            }else{
            	request.setAttribute("error", "W1001");
            	try {
					request.getRequestDispatcher("/3g/company/company.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::getCompanyDepart::" + e.getMessage());
				}
            }
		}
	}
	
	/**
	 * 添加一级区域
	 * @param args
	 * @param response
	 */
	private void insertTopMarket(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertTopMarket::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertTopMarket::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeName = EncodingTool.encodeStr(args.getStoreName());
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherId", companyId);
	    businessJson.put("fatherName", companyName);
	    businessJson.put("fatherLevelNum", "0");
	    businessJson.put("storeName", storeName);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21101");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertTopMarket::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertTopMarket::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertTopMarket::return code::" + returnCode);
		logger.info("wape-web::insertTopMarket::return msg::" + returnMsg);
		
		if("200".equals(returnCode)){
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 至一级区域操作页面
	 */
	private void toOperMarket(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
				HttpSession httpSession ){
			//基础数据
			ReturnPojo rp = new ReturnPojo();
			JSONObject json = new JSONObject();
			UserList user = (UserList) httpSession.getAttribute("user");
			String token=(String) httpSession.getAttribute("token");
			String atUserId=(String) httpSession.getAttribute("atUserId");
			//传递参数
			String openId = args.getOpenId();
			String isWX = args.getIsWX();
			request.setAttribute("openId", openId);
			request.setAttribute("isWX", isWX);
			//公参
			String timestamp = Utils.getCurrTimeMillions();
		    String nonce = Utils.getNonce();
			String sign = "";
			try {
				sign = TokenUtils.getSign(token, timestamp, nonce);
			} catch (NoSuchAlgorithmException e3) {
				logger.error("wape-web::toOperMarket::sign make error::" + e3.getMessage());
			}
			String ipaddr = "";
			try {
				ipaddr = Utils.getIpAddress(request);
			} catch (IOException e2) {
				logger.error("wape-web::toOperMarket::ip not get::" + e2.getMessage());
			}
		    String device = "WX";
		    String mac = "00-00-00-00-000";
		    String editUserId = atUserId;
		    String editTime = timestamp;
		    String realName = EncodingTool.encodeStr(user.getRealName());
		    String companyId = user.getCompanyId();
		    String companyName = EncodingTool.encodeStr(user.getCompanyName());
		    String departmentId = user.getDepartmentId();
		    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
		    //业务参数
		    String storeName = EncodingTool.encodeStr(args.getStoreName());
		    JSONObject businessJson = new JSONObject();
		    businessJson.put("atUserId", atUserId);
		    businessJson.put("fatherId", companyId);
		    String business = businessJson.toString();
			Map<String, String> params = new HashMap<String, String>();
			params.put("serviceCode", "MMZS21102");
			params.put("sign", sign);
			params.put("timestamp", timestamp);
			params.put("nonce", nonce);
			params.put("editUserId", editUserId);
			params.put("editTime", editTime);
			params.put("ipaddr", ipaddr);
			params.put("device", device);
			params.put("mac", mac);
			params.put("realName", realName);
			params.put("companyId", companyId);
			params.put("companyName", companyName);
			params.put("departmentId", departmentId);
			params.put("departmentName", departmentName);
			params.put("business", business);
			logger.info("wape-web::toOperMarket::business is :" + business);
			String resultString = sendhttp(marketPath, params);
			logger.info("wape-web::toOperMarket::return::" + resultString);
			JSONObject resultJson=JSON.parseObject(resultString);
			String returnCode = resultJson.getString("returnCode");
			String returnMsg = resultJson.getString("returnMsg");
			logger.info("wape-web::toOperMarket::return code::" + returnCode);
			logger.info("wape-web::toOperMarket::return msg::" + returnMsg);
			if("200".equals(returnCode)){
				JSONObject resultObject=(JSONObject) resultJson.get("result");
		        JSONArray array = JSONArray.parseArray(resultObject.getString("markets"));
		        List<MarketStore> list = JSON.toJavaObject(array, List.class);
	        	request.setAttribute("markets", list);
				try {
					request.getRequestDispatcher("/3g/platform/shop-rent/wp/zone.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::toOperMarket::send error" + e.getMessage());
				}
			}else{
				try {
					request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
				} catch (Exception e) {
					logger.info("wape-web::toOperMarket::send error" + e.getMessage());
				}
			}
			writeJsonToResponse(response, json.toJSON(rp).toString());
		}
	 
	/**
	 * 至区域概要信息列表
	 */
	private void toOutlineAllMarket(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::toOutlineAllMarket::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::toOutlineAllMarket::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherId", companyId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21108");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::toOutlineAllMarket::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::toOutlineAllMarket::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::toOutlineAllMarket::return code::" + returnCode);
		logger.info("wape-web::toOutlineAllMarket::return msg::" + returnMsg);
		if("200".equals(returnCode)){
			JSONObject resultObject=(JSONObject) resultJson.get("result");
	        JSONArray array = JSONArray.parseArray(resultObject.getString("markets"));
	        List<MarketStore> list = JSON.toJavaObject(array, List.class);
        	request.setAttribute("markets", list);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/market.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::toOutlineAllMarket::send error" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/404.jsp").forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::toOutlineAllMarket::send error" + e.getMessage());
			}
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 添加二级区域
	 * @param args
	 * @param response
	 */
	private void insertSecondMarket(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertSecondMarket::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertSecondMarket::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherId", args.getFatherId());
	    businessJson.put("fatherName", EncodingTool.encodeStr(args.getFatherName()));
	    businessJson.put("fatherLevelNum", args.getFatherLevelNum());
	    businessJson.put("fatherType", EncodingTool.encodeStr(args.getFatherType()));
	    businessJson.put("storeName", EncodingTool.encodeStr(args.getStoreName()));
	    businessJson.put("storeType", EncodingTool.encodeStr(args.getStoreType()));
	    businessJson.put("totalArea", args.getTotalArea());
	    businessJson.put("storeRemark", args.getStoreRemark());
	    businessJson.put("packingCount", args.getPackingCount());
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21109");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertSecondMarket::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertSecondMarket::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertSecondMarket::return code::" + returnCode);
		logger.info("wape-web::insertSecondMarket::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				response.sendRedirect("centerService?serviceCode=MMZS21108");
				return;
			} catch (Exception e) {
				logger.info("wape-web::insertSecondMarket::to market.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/sub-region.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::insertSecondMarket::to sub-region.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查看区域详情
	 * @param args
	 * @param response
	 */
	private void queryMarketDetail(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryMarketDetail::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryMarketDetail::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", args.getStoreId());
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21103");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryMarketDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryMarketDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryMarketDetail::return code::" + returnCode);
		logger.info("wape-web::queryMarketDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONObject marketobj = JSON.parseObject(obj.getString("marketStore"));
			JSONArray propobj = JSON.parseArray(obj.getString("marketProp"));
			MarketStore ms = JSON.toJavaObject(marketobj, MarketStore.class);
			List<MarketStoreProp> prop = JSON.toJavaObject(propobj, List.class);
			request.setAttribute("market", ms);
			request.setAttribute("prop", prop);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/market-second.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryMarketDetail::to market-second.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/sub-region.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryMarketDetail::to sub-region.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 添加市场其他信息
	 * @param args
	 * @param response
	 */
	private void insertMarketOtherInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryMarketDetail::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryMarketDetail::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    String propName = EncodingTool.encodeStr(args.getPropName());
	    String propValue = EncodingTool.encodeStr(args.getPropValue());
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", args.getStoreId());
	    businessJson.put("propName", propName);
	    businessJson.put("propValue", propValue);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21105");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryMarketDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryMarketDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryMarketDetail::return code::" + returnCode);
		logger.info("wape-web::queryMarketDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			rp.setResult(obj);
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 修改市场其他信息
	 * @param args
	 * @param response
	 */
	private void updateMarketOtherInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::updateMarketOtherInfo::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::updateMarketOtherInfo::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storePropId = args.getStorePropId();
	    String propName = args.getPropName();
	    String propValue = args.getPropValue();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storePropId", storePropId);
	    businessJson.put("propName", propName);
	    businessJson.put("propValue", propValue);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21106");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::updateMarketOtherInfo::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::updateMarketOtherInfo::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::updateMarketOtherInfo::return code::" + returnCode);
		logger.info("wape-web::updateMarketOtherInfo::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 至商铺列表
	 * @param args
	 * @param response
	 */
	private void toStoreList(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::toStoreList::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::toStoreList::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String fatherType = args.getFatherType();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherType", fatherType);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21201");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::toStoreList::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::toStoreList::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::toStoreList::return code::" + returnCode);
		logger.info("wape-web::toStoreList::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONArray marketobj = JSON.parseArray(obj.getString("markets"));
			JSONArray storeobj = JSON.parseArray(obj.getString("stores"));
			List<MarketStore> markets = JSON.toJavaObject(marketobj, List.class);
			List<MarketStore> stores = JSON.toJavaObject(storeobj, List.class);
			request.setAttribute("markets", markets);
			request.setAttribute("stores", stores);
			request.setAttribute("fatherType", fatherType);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/op/rental-stalls.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to rental-stalls.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/op/rental-stalls.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to rental-stalls.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 至商铺列表，租金
	 * @param args
	 * @param response
	 */
	private void toStoreListByRental(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::toStoreList::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::toStoreList::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String fatherType = args.getFatherType();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherType", fatherType);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21210");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::toStoreList::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::toStoreList::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::toStoreList::return code::" + returnCode);
		logger.info("wape-web::toStoreList::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONArray marketobj = JSON.parseArray(obj.getString("markets"));
			JSONArray storeobj = JSON.parseArray(obj.getString("stores"));
			List<MarketStore> markets = JSON.toJavaObject(marketobj, List.class);
			List<MarketStore> stores = JSON.toJavaObject(storeobj, List.class);
			request.setAttribute("markets", markets);
			request.setAttribute("stores", stores);
			request.setAttribute("fatherType", fatherType);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/op/rent-manage.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to rental-stalls.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/op/rent-manage.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to rental-stalls.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 至商铺列表，档口分布，
	 * @param args
	 * @param response
	 */
	private void toStoreListNotState(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::toStoreList::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::toStoreList::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String fatherType = args.getFatherType();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("fatherType", fatherType);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21201");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::toStoreList::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::toStoreList::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::toStoreList::return code::" + returnCode);
		logger.info("wape-web::toStoreList::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONArray marketobj = JSON.parseArray(obj.getString("markets"));
			JSONArray storeobj = JSON.parseArray(obj.getString("stores"));
			List<MarketStore> markets = JSON.toJavaObject(marketobj, List.class);
			List<MarketStore> stores = JSON.toJavaObject(storeobj, List.class);
			request.setAttribute("markets", markets);
			request.setAttribute("stores", stores);
			request.setAttribute("fatherType", fatherType);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/stall-distribution.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to stall-distribution.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/stall-distribution.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::toStoreList::to stall-distribution.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 添加商铺
	 * @param args
	 * @param response
	 */
	private void insertStore(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertStore::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeName = args.getStoreName();
	    String fatherId = args.getFatherId();
	    String fatherName = args.getFatherName();
	    String fatherLevelNum = args.getFatherLevelNum();
	    String fatherType = args.getFatherType();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeName", storeName);
	    businessJson.put("fatherId", fatherId);
	    businessJson.put("fatherName", fatherName);
	    businessJson.put("fatherLevelNum", fatherLevelNum);
	    businessJson.put("fatherType", fatherType);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21202");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertStore::return code::" + returnCode);
		logger.info("wape-web::insertStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			rp.setResult(resultJson.getString("result"));
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 查看商铺概况
	 * @param args
	 * @param response
	 */
	private void queryStoreBrief(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String topMarket = EncodingTool.encodeStr(args.getTopMarket());
		String fatherRemark = args.getFatherRemark();
		String fatherTotalArea = args.getFatherTotalArea();
		request.setAttribute("topMarket",topMarket);
		request.setAttribute("fatherRemark",fatherRemark);
		request.setAttribute("fatherTotalArea",fatherTotalArea);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryStoreBrief::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryStoreBrief::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21203");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryStoreBrief::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryStoreBrief::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryStoreBrief::return code::" + returnCode);
		logger.info("wape-web::queryStoreBrief::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			MarketStore store = JSON.toJavaObject(obj, MarketStore.class);
			request.setAttribute("store", store);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/stalls-profile.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreBrief::to stalls-profile.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/stalls-profile.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreBrief::to stalls-profile.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查看商铺详细及设施
	 * @param args
	 * @param response
	 */
	private void queryStoreDetailAndSub(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String topMarket = EncodingTool.encodeStr(args.getTopMarket());
		String fatherRemark = args.getFatherRemark();
		String fatherTotalArea = args.getFatherTotalArea();
		request.setAttribute("topMarket",topMarket);
		request.setAttribute("fatherRemark",fatherRemark);
		request.setAttribute("fatherTotalArea",fatherTotalArea);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryStoreDetail::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryStoreDetail::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21204");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryStoreDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryStoreDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryStoreDetail::return code::" + returnCode);
		logger.info("wape-web::queryStoreDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONObject storeJson = JSON.parseObject(obj.getString("store"));
			JSONArray propJson = JSON.parseArray(obj.getString("storeProp"));
			MarketStore store = JSON.toJavaObject(storeJson, MarketStore.class);
			List<MarketStoreProp> prop = JSON.toJavaObject(propJson, List.class);
			request.setAttribute("store", store);
			request.setAttribute("prop", prop);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/shop-details.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to shop-details.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/shop-details.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to shop-details.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查看商铺详细及面积
	 * @param args
	 * @param response
	 */
	private void queryStoreDetailAndArea(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String topMarket = EncodingTool.encodeStr(args.getTopMarket());
		String fatherRemark = args.getFatherRemark();
		String fatherTotalArea = args.getFatherTotalArea();
		request.setAttribute("topMarket",topMarket);
		request.setAttribute("fatherRemark",fatherRemark);
		request.setAttribute("fatherTotalArea",fatherTotalArea);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryStoreDetail::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryStoreDetail::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21205");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryStoreDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryStoreDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryStoreDetail::return code::" + returnCode);
		logger.info("wape-web::queryStoreDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONObject storeJson = JSON.parseObject(obj.getString("store"));
			JSONArray propJson = JSON.parseArray(obj.getString("storeProp"));
			MarketStore store = JSON.toJavaObject(storeJson, MarketStore.class);
			List<MarketStoreProp> prop = JSON.toJavaObject(propJson, List.class);
			request.setAttribute("store", store);
			request.setAttribute("prop", prop);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/edit-store.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to edit-store.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/edit-store.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to edit-store.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查看商铺详细及面积
	 * @param args
	 * @param response
	 */
	private void updateStoreDetail(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryStoreDetail::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryStoreDetail::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    String rentalArea = args.getRentalArea();
	    String storeType = args.getStoreType();
	    String usableArea = args.getUsableArea();
	    String poolArea = args.getPoolArea();
	    String packingCount = args.getPackingCount();
	    String packingArea = args.getPackingArea();
	    String otherArea = args.getOtherArea();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    businessJson.put("rentalArea", rentalArea);
	    businessJson.put("storeType", storeType);
	    businessJson.put("usableArea", usableArea);
	    businessJson.put("poolArea", poolArea);
	    businessJson.put("packingCount", packingCount);
	    businessJson.put("packingArea", packingArea);
	    businessJson.put("otherArea", otherArea);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21206");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryStoreDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryStoreDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryStoreDetail::return code::" + returnCode);
		logger.info("wape-web::queryStoreDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 添加商铺面积信息
	 * @param args
	 * @param response
	 */
	private void insertStoreAreaInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertStoreAreaInfo::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertStoreAreaInfo::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    String propName = EncodingTool.encodeStr(args.getPropName());
	    String propValue = EncodingTool.encodeStr(args.getPropValue());
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    businessJson.put("propName", propName);
	    businessJson.put("propValue", propValue);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21207");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertStoreAreaInfo::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertStoreAreaInfo::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertStoreAreaInfo::return code::" + returnCode);
		logger.info("wape-web::insertStoreAreaInfo::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = resultJson.getJSONObject("result");
			rp.setResult(obj);
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 修改商铺面积信息
	 * @param args
	 * @param response
	 */
	private void updateStoreAreaInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::updateStoreAreaInfo::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::updateStoreAreaInfo::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storePropId = args.getStorePropId();
	    String propName = args.getPropName();
	    String propValue = args.getPropValue();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storePropId", storePropId);
	    businessJson.put("propName", propName);
	    businessJson.put("propValue", propValue);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21208");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::updateStoreAreaInfo::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::updateStoreAreaInfo::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::updateStoreAreaInfo::return code::" + returnCode);
		logger.info("wape-web::updateStoreAreaInfo::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 操作管理商铺设施
	 * @param args
	 * @param response
	 */
	private void touOperSubInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String topMarket = EncodingTool.encodeStr(args.getTopMarket());
		String fatherRemark = args.getFatherRemark();
		String fatherTotalArea = args.getFatherTotalArea();
		request.setAttribute("topMarket",topMarket);
		request.setAttribute("fatherRemark",fatherRemark);
		request.setAttribute("fatherTotalArea",fatherTotalArea);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::touOperSubInfo::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::touOperSubInfo::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21204");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryStoreDetail::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryStoreDetail::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryStoreDetail::return code::" + returnCode);
		logger.info("wape-web::queryStoreDetail::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			JSONObject obj = JSON.parseObject(resultJson.getString("result"));
			JSONObject storeJson = JSON.parseObject(obj.getString("store"));
			JSONArray propJson = JSON.parseArray(obj.getString("storeProp"));
			MarketStore store = JSON.toJavaObject(storeJson, MarketStore.class);
			List<MarketStoreProp> prop = JSON.toJavaObject(propJson, List.class);
			request.setAttribute("store", store);
			request.setAttribute("prop", prop);
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/edit-list.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to edit-list.jsp error::" + e.getMessage());
			}
		}else{
			try {
				request.getRequestDispatcher("/3g/platform/shop-rent/mp/edit-list.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to edit-list.jsp error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 
	 * @param args
	 * @param response
	 */
	private void toUserInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String serviceAddrgs = authPath;
		String atUserId=(String) httpSession.getAttribute("atUserId");
		UserList user=(UserList) httpSession.getAttribute("user");
		CompanyList company=(CompanyList) httpSession.getAttribute("company");
		logger.info("wape-web::toUserInfo::atUserId" + atUserId);
		logger.info("wape-web::toUserInfo::user" + user);
		logger.info("wape-web::toUserInfo::company" + company);
		try {
			request.getRequestDispatcher("/3g/mine/join.jsp").forward(request, response);
		} catch (Exception e) {
			logger.info("wape-web::toUserInfo::to join.jsp error::" + e.getMessage());
		}
	}
	
	/**
	 * 中转接口
	 * @param args
	 * @param response
	 */
	private void transferTarget(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		String isWX = args.getIsWX();
		String targetURL = args.getTargetURL();
		String prefix = args.getPrefix();
		if(!StringUtils.isEmpty(prefix)){
			prefix = prefix.replaceAll("_", "/");
		}
		String openId = args.getOpenId();
		String toEntrance = args.getEntrance();
		String toParam = EncodingTool.encodeStr(args.getToParam());
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		logger.info("nsy-core::transferTarget::isWX::" + isWX);
		logger.info("nsy-core::transferTarget::targetURL::" + targetURL);
		logger.info("nsy-core::transferTarget::prefix::" + prefix);
		logger.info("nsy-core::transferTarget::openId::" + openId);
		if("yes".equals(toEntrance)){ //跳转至微信公众号入口使用微信跳转方式
			String entr = "/" + prefix + "/" + targetURL + ".jsp";
			String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + wapeWechatAppID + "&redirect_uri=" 
			+ Constants.WEB_SERVICE_ADDR + entr
			+ "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
			logger.info("nsy-core::transferTarget::toEntrance send::" + url);
			try {
				response.sendRedirect(url);
				return;
			} catch (Exception e) {
				logger.info("wape-web::transferTarget::request send url error" + url);
			}
		}else{ 
			String url = "/" + prefix + "/" + targetURL + ".jsp";
			if(!StringUtils.isEmpty(toParam)){
				StringBuffer params = new StringBuffer();
				JSONObject json = JSON.parseObject(toParam);
				Set<String> set = json.keySet();
				Iterator<String> it = set.iterator();
				String key = null;
				String value = null;
				while(it.hasNext()){
					 key = it.next();
					 value = json.getString(key);
//					 params.append("&").append(key).append("=").append(value);
					 request.setAttribute(key, value);
				}
//				url = url + params.toString().replaceFirst("&", "?");
			}
			logger.info("wape-web::transferTarget::normal send::" + url);
			try {
				request.getRequestDispatcher(url).forward(request, response);
			} catch (Exception e) {
				logger.info("wape-web::transferTarget::request send url error" + url);
			}
		}
	}
	
	private void laqu(ArgsPojo args, HttpServletResponse response,HttpServletRequest request){
		Map<String, String> params = new HashMap<String, String>();
		params.put("appid", "wx167b18378241425a");
		params.put("secret", "4bba534321b209d2d3dd8a2e35b630b1");
		params.put("grant_type", "client_credential");
        String serviceString = sendhttp("https://api.weixin.qq.com/cgi-bin/token", params);
        JSONObject obj = JSON.parseObject(serviceString.toString());
        if(StringUtils.isEmpty(obj.getString("errcode"))){ //成功返回
        	String atk = obj.getString("access_token");
        	String noid = "";
        	//拉取用户信息列表
        	Map<String, String> lqparams = new HashMap<String, String>();
        	lqparams.put("access_token", atk);
        	if(!StringUtils.isEmpty(noid)){
        		lqparams.put("next_openid", noid);
        	}
            String lqserviceString = sendhttp("https://api.weixin.qq.com/cgi-bin/user/get", lqparams);
            JSONObject lqobj = JSON.parseObject(lqserviceString);
            System.out.println(lqobj.toJSONString());
        	logger.info("wape-web::laqu::get access_token::" + atk);
        }else{
        	logger.info("wape-web::laqu::error access_token:" + obj.getString("errmsg"));
        }
        
//        writeJsonToResponse(response, obj.getString("openid"));
	}
	
	/**
	 * 添加商铺设施信息
	 * @param args
	 * @param response
	 */
	private void insertStoreSubInfo(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		String topMarket = EncodingTool.encodeStr(args.getTopMarket());
		String fatherRemark = args.getFatherRemark();
		String fatherTotalArea = args.getFatherTotalArea();
		request.setAttribute("topMarket",topMarket);
		request.setAttribute("fatherRemark",fatherRemark);
		request.setAttribute("fatherTotalArea",fatherTotalArea);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertStoreSubInfo::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertStoreSubInfo::ip not get::" + e2.getMessage());
		}
	    String device = "WX";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String storeId = args.getStoreId();
		String propState = args.getPropState();
		String propName = EncodingTool.encodeStr(args.getPropName());
		String propValue = EncodingTool.encodeStr(args.getPropValue());
		String propModel = args.getPropModel();
		String propUnit = args.getPropUnit();
		String propCount = args.getPropCount();
		String propRemarker = args.getPropRemarker();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    businessJson.put("propName", propValue);
	    businessJson.put("propValue", propValue);
	    businessJson.put("propState", propState);
	    businessJson.put("propModel", propModel);
	    businessJson.put("propUnit", propUnit);
	    businessJson.put("propCount", propCount);
	    businessJson.put("propRemarker", propRemarker);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS21209");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertStoreSubInfo::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertStoreSubInfo::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertStoreSubInfo::return code::" + returnCode);
		logger.info("wape-web::insertStoreSubInfo::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::queryStoreDetail::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 查询冷库中货物
	 * @param args
	 * @param response
	 */
	private void queryGoodsInColdStorage(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::queryGoodsInColdStorage::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::queryGoodsInColdStorage::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    String inStorageNum = args.getInStorageNum();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("inStorageNum", inStorageNum);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MMZS23101");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::queryGoodsInColdStorage::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::queryGoodsInColdStorage::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::queryGoodsInColdStorage::return code::" + returnCode);
		logger.info("wape-web::queryGoodsInColdStorage::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			ColdStorage cs = JSON.toJavaObject(resultJson.getJSONObject("result"), ColdStorage.class);
			rp.setResult(cs);
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}else{
			rp.setReturnCode(returnCode);
			rp.setReturnMsg(returnMsg);
		}
		writeJsonToResponse(response, json.toJSON(rp).toString());
	}
	
	/**
	 * 录入合同
	 * @param args
	 * @param response
	 */
	private void insertLeasingContract(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::insertLeasingContract::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::insertLeasingContract::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String contractName = EncodingTool.encodeStr(args.getContractName());
	    String tenantState = args.getTenantState();
	    String contractMode = args.getContractMode();
	    String contractType = args.getContractType();
	    String contractState = args.getContractState();
	    String contractStateName = null;
	    if(!StringUtils.isEmpty(contractState)){
	    	if("10".equals(contractState)){
	    		contractStateName = "正式合同执行中";
	    	}else if("20".equals(contractState)){
	    		contractStateName = "临时协议";
	    	}else if("30".equals(contractState)){
	    		contractStateName = "合同终止";
	    	}else if("40".equals(contractState)){
	    		contractStateName = "挪铺位";
	    	}
	    }
	    String tenantday = args.getTenantday();
	    String hiredate = args.getHiredate();
	    String closingday = args.getClosingday();
	    String tenantName = EncodingTool.encodeStr(args.getTenantName());
	    String tenantPhone = args.getTenantPhone();
	    String idNum = args.getIdNum();
	    String tenantCompanyName = EncodingTool.encodeStr(args.getTenantCompanyName());
	    String contractRemark = EncodingTool.encodeStr(args.getContractRemark());
	    String storeId = args.getStoreId();
	    String storeName = EncodingTool.encodeStr(args.getStoreName());
	    String fatherId = args.getFatherId();
	    String fatherName = EncodingTool.encodeStr(args.getFatherName());
	    String fatherType = args.getFatherType();
	    lc.setContractNum(contractNum);
	    lc.setContractName(contractName);
	    lc.setTenantState(tenantState);
	    lc.setContractMode(contractMode);
	    lc.setContractType(contractType);
	    lc.setContractState(contractState);
	    lc.setContractStateName(contractStateName);
	    lc.setTenantday(tenantday);
	    lc.setHiredate(hiredate);
	    lc.setClosingday(closingday);
	    lc.setTenantName(tenantName);
	    lc.setTenantPhone(tenantPhone);
	    lc.setIdNum(idNum);
	    lc.setTenantCompanyName(tenantCompanyName);
	    lc.setContractRemark(contractRemark);
	    lc.setStoreId(storeId);
	    lc.setStoreName(storeName);
	    lc.setFatherId(fatherId);
	    lc.setFatherName(fatherName);
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("leasingContract", lc);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1001");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::insertLeasingContract::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::insertLeasingContract::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::insertLeasingContract::return code::" + returnCode);
		logger.info("wape-web::insertLeasingContract::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
				String url = "centerService?serviceCode=MMZS21211&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::insertLeasingContract::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
				String url = "centerService?serviceCode=MMZS21211&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::insertLeasingContract::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 定金缴费
	 * @param args
	 * @param response
	 */
	private void payDeposit(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payDeposit::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payDeposit::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String deposit = args.getDeposit();
	    String remark = EncodingTool.encodeStr(args.getRemark());
	    String fatherType = args.getFatherType();
	    String storeId = args.getStoreId();
	    String storeName = args.getStoreName();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("contractNum", contractNum);
	    businessJson.put("deposit", deposit);
	    businessJson.put("remark", remark);
	    businessJson.put("storeId", storeId);
	    businessJson.put("storeName", storeName);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1002");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payDeposit::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payDeposit::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payDeposit::return code::" + returnCode);
		logger.info("wape-web::payDeposit::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				String url = "centerService?serviceCode=MMZS21211&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				String url = "centerService?serviceCode=MMZS21211&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 租金缴费
	 * @param args
	 * @param response
	 */
	private void payRental(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payRental::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payRental::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String rental = args.getRental();
	    String startTime = args.getStartTime();
	    String endTime = args.getEndTime();
	    String remark = EncodingTool.encodeStr(args.getRemark());
	    String fatherType = args.getFatherType();
	    String storeId = args.getStoreId();
	    String storeName = args.getStoreName();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("contractNum", contractNum);
	    businessJson.put("rental", rental);
	    businessJson.put("startTime", startTime);
	    businessJson.put("endTime", endTime);
	    businessJson.put("remark", remark);
	    businessJson.put("storeId", storeId);
	    businessJson.put("storeName", storeName);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1005");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payRental::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payRental::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payRental::return code::" + returnCode);
		logger.info("wape-web::payRental::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				String url = "centerService?serviceCode=MMZS21212&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payRental::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				String url = "centerService?serviceCode=MMZS21212&fatherType=" + fatherType;
				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payRental::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 根据商铺查询合同
	 * @param args
	 * @param response
	 */
	private void queryLeasingContractByStore(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payDeposit::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payDeposit::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    String topMarket = args.getTopMarket();
	    String fatherName = args.getFatherName();
	    String storeRemark = args.getStoreRemark();
	    String storeName = args.getStoreName(); 
	    String fatherType = args.getFatherType();
	    request.setAttribute("topMarket",EncodingTool.encodeStr(topMarket));
		request.setAttribute("fatherName",EncodingTool.encodeStr(fatherName));
		request.setAttribute("storeRemark",EncodingTool.encodeStr(storeRemark));
		request.setAttribute("storeId",args.getStoreId());
		request.setAttribute("storeName",EncodingTool.encodeStr(storeName));
		request.setAttribute("fatherType",fatherType);
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1011");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payDeposit::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payDeposit::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payDeposit::return code::" + returnCode);
		logger.info("wape-web::payDeposit::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {	
				JSONObject jsonobj = resultJson.getJSONObject("result");
				JSONObject leansingobj = jsonobj.getJSONObject("leasingContract");
				LeasingContract leasing = JSON.toJavaObject(leansingobj, LeasingContract.class);
				request.setAttribute("leasing", leasing);
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-yp.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-yp.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 查询商铺合同情况,商铺维度
	 * @param args
	 * @param response
	 */
	private void collectLeasingContractFromStore(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::collectLeasingContractByStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::collectLeasingContractByStore::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1003");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::collectLeasingContractByStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::collectLeasingContractByStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::collectLeasingContractByStore::return code::" + returnCode);
		logger.info("wape-web::collectLeasingContractByStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				//去重遍历，将二级区域分类
				JSONObject resultObj = resultJson.getJSONObject("result");
				List<MarketStore> markets = new ArrayList<MarketStore>();
				Map<String, MarketStore> mkMap = new HashMap<String, MarketStore>();
				JSONArray mks = resultObj.getJSONArray("marketStore");
				for(int i = 0, isize = mks.size(); i < isize; i++){
					MarketStore ms =  JSON.toJavaObject(mks.getJSONObject(i), MarketStore.class);
					mkMap.put(ms.getFatherId(), ms);
				}
				Iterator it = mkMap.keySet().iterator();  
				while (it.hasNext()) {  
					String key = it.next().toString();  
					markets.add(mkMap.get(key));  
				}
				request.setAttribute("markets", markets);
//				List<MarketStore> stores = JSON.toJavaObject(mks, List.class);
				List<MarketStore> stores = new ArrayList<MarketStore>();
				
				JSONArray lcs = resultObj.getJSONArray("leasingContract");
//				List<LeasingContract> leasing = JSON.toJavaObject(lcs, List.class);
				LeasingContract lc = new LeasingContract();
				for(int j = 0, jsize = mks.size();j < jsize; j++){
					MarketStore ms = JSON.toJavaObject(mks.getJSONObject(j), MarketStore.class);
					for(int k = 0, ksize = lcs.size(); k < ksize; k++){
						lc = JSON.toJavaObject(lcs.getJSONObject(k), LeasingContract.class);
						if(ms.getStoreId().equals(lc.getStoreId())){
							ms.setContractNum(lc.getContractNum());
							ms.setTenantName(lc.getTenantName());
							ms.setTenantday(lc.getTenantday());
							break;
						}
					}
					stores.add(ms);
				}
				
				request.setAttribute("leasing", stores);
				//end
				
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-manage.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-manage.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21209 error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查询商铺合同情况，按时间维度
	 * @param args
	 * @param response
	 */
	private void collectLeasingContractFromTime(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::collectLeasingContractByStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::collectLeasingContractByStore::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1003");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::collectLeasingContractByStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::collectLeasingContractByStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::collectLeasingContractByStore::return code::" + returnCode);
		logger.info("wape-web::collectLeasingContractByStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				//去重遍历，将二级区域分类
				JSONObject resultObj = resultJson.getJSONObject("result");
				List<String> times = new ArrayList<String>();
				Map<String, String> mkMap = new HashMap<String, String>();
				JSONArray lcs = resultObj.getJSONArray("leasingContract");
				for(int i = 0, isize = lcs.size(); i < isize; i++){
					LeasingContract lc =  JSON.toJavaObject(lcs.getJSONObject(i), LeasingContract.class);
					String month = lc.getTenantday().substring(0, 7);
					mkMap.put(month, month);
				}
				Iterator it = mkMap.keySet().iterator();  
				while (it.hasNext()) {  
					String key = it.next().toString();  
					times.add(mkMap.get(key));  
				}
				request.setAttribute("times", times);
//				JSONArray lcs = resultObj.getJSONArray("leasingContract");
				List<LeasingContract> leasing = JSON.toJavaObject(lcs, List.class);
				request.setAttribute("leasing", leasing);
				//end
				
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-manage-recent.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-manage-recent.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21209 error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查询商铺定金缴费情况,商铺维度
	 * @param args
	 * @param response
	 */
	private void collectDepositFromStore(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::collectLeasingContractByStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::collectLeasingContractByStore::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1004");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::collectLeasingContractByStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::collectLeasingContractByStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::collectLeasingContractByStore::return code::" + returnCode);
		logger.info("wape-web::collectLeasingContractByStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				//去重遍历，将二级区域分类
				JSONObject resultObj = resultJson.getJSONObject("result");
				List<MarketStore> markets = new ArrayList<MarketStore>();
				Map<String, MarketStore> mkMap = new HashMap<String, MarketStore>();
				JSONArray mks = resultObj.getJSONArray("marketStore");
				for(int i = 0, isize = mks.size(); i < isize; i++){
					MarketStore ms =  JSON.toJavaObject(mks.getJSONObject(i), MarketStore.class);
					mkMap.put(ms.getFatherId(), ms);
				}
				Iterator it = mkMap.keySet().iterator();  
				while (it.hasNext()) {  
					String key = it.next().toString();  
					markets.add(mkMap.get(key));  
				}
				request.setAttribute("markets", markets);
//				List<MarketStore> stores = JSON.toJavaObject(mks, List.class);
				List<MarketStore> stores = new ArrayList<MarketStore>();
				
				JSONArray cms = resultObj.getJSONArray("chargesManagement");
//				List<LeasingContract> leasing = JSON.toJavaObject(lcs, List.class);
				ChargesManagement cm = new ChargesManagement();
				for(int j = 0, jsize = mks.size();j < jsize; j++){
					MarketStore ms = JSON.toJavaObject(mks.getJSONObject(j), MarketStore.class);
					for(int k = 0, ksize = cms.size(); k < ksize; k++){
						cm = JSON.toJavaObject(cms.getJSONObject(k), ChargesManagement.class);
						if(ms.getStoreId().equals(cm.getSonStoreId())){
							ms.setContractNum(cm.getChargesKey());
							ms.setDeposit(cm.getPayment());
							ms.setChargesDay(cm.getChargesDay());
							break;
						}
					}
					stores.add(ms);
				}
				
				request.setAttribute("deposit", stores);
				//end
				
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21209 error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 查询商铺定金缴费情况，按时间维度
	 * @param args
	 * @param response
	 */
	private void collectDepositFromTime(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::collectLeasingContractByStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::collectLeasingContractByStore::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1004");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::collectLeasingContractByStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::collectLeasingContractByStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::collectLeasingContractByStore::return code::" + returnCode);
		logger.info("wape-web::collectLeasingContractByStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				//去重遍历，将二级区域分类
				JSONObject resultObj = resultJson.getJSONObject("result");
				List<String> times = new ArrayList<String>();
				Map<String, String> mkMap = new HashMap<String, String>();
				JSONArray cms = resultObj.getJSONArray("chargesManagement");
				for(int i = 0, isize = cms.size(); i < isize; i++){
					ChargesManagement cm =  JSON.toJavaObject(cms.getJSONObject(i), ChargesManagement.class);
					String month = cm.getChargesDay().substring(0, 7);
					mkMap.put(month, month);
				}
				Iterator it = mkMap.keySet().iterator();  
				while (it.hasNext()) {  
					String key = it.next().toString();  
					times.add(mkMap.get(key));  
				}
				request.setAttribute("times", times);
//				JSONArray lcs = resultObj.getJSONArray("leasingContract");
				List<ChargesManagement> deposit = JSON.toJavaObject(cms, List.class);
				request.setAttribute("deposit", deposit);
				//end
				
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect-recent.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect-recent.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectLeasingContractByStore::to MMZS21209 error::" + e.getMessage());
			}
		}
	}
	
	/**
	 * 根据合同号查询合同(合同明细)
	 * @param args
	 * @param response
	 */
	private void queryLeasingContractByLeasing(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payDeposit::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payDeposit::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    String topMarket = args.getTopMarket();
	    String fatherName = args.getFatherName();
	    String storeRemark = args.getStoreRemark();
	    String storeName = args.getStoreName(); 
	    String fatherType = args.getFatherType();
	    request.setAttribute("topMarket",EncodingTool.encodeStr(topMarket));
		request.setAttribute("fatherName",EncodingTool.encodeStr(fatherName));
		request.setAttribute("storeRemark",EncodingTool.encodeStr(storeRemark));
		request.setAttribute("storeId",args.getStoreId());
		request.setAttribute("storeName",EncodingTool.encodeStr(storeName));
		request.setAttribute("fatherType",fatherType);
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("contractNum", contractNum);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1012");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payDeposit::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payDeposit::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payDeposit::return code::" + returnCode);
		logger.info("wape-web::payDeposit::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {	
				JSONObject jsonobj = resultJson.getJSONObject("result");
				JSONObject leansingobj = jsonobj.getJSONObject("leasingContract");
				LeasingContract leasing = JSON.toJavaObject(leansingobj, LeasingContract.class);
				request.setAttribute("leasing", leasing);
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-detail.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-detail.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 根据合同号查询合同(定金明细)
	 * @param args
	 * @param response
	 */
	private void queryLeasingContractByDeposit(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payDeposit::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payDeposit::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    String topMarket = args.getTopMarket();
	    String fatherName = args.getFatherName();
	    String storeRemark = args.getStoreRemark();
	    String storeName = args.getStoreName(); 
	    String fatherType = args.getFatherType();
	    request.setAttribute("topMarket",EncodingTool.encodeStr(topMarket));
		request.setAttribute("fatherName",EncodingTool.encodeStr(fatherName));
		request.setAttribute("storeRemark",EncodingTool.encodeStr(storeRemark));
		request.setAttribute("storeId",args.getStoreId());
		request.setAttribute("storeName",EncodingTool.encodeStr(storeName));
		request.setAttribute("fatherType",fatherType);
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("contractNum", contractNum);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1012");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payDeposit::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payDeposit::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payDeposit::return code::" + returnCode);
		logger.info("wape-web::payDeposit::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {	
				JSONObject jsonobj = resultJson.getJSONObject("result");
				JSONObject leansingobj = jsonobj.getJSONObject("leasingContract");
				LeasingContract leasing = JSON.toJavaObject(leansingobj, LeasingContract.class);
				request.setAttribute("leasing", leasing);
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-yp.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/contract-collection-yp.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 根据商铺查询合同(缴租金)
	 * @param args
	 * @param response
	 */
	private void queryLeasingContractByStoreRent(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::payDeposit::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::payDeposit::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    String topMarket = args.getTopMarket();
	    String fatherName = args.getFatherName();
	    String storeRemark = args.getStoreRemark();
	    String storeName = args.getStoreName(); 
	    String fatherType = args.getFatherType();
	    request.setAttribute("topMarket",EncodingTool.encodeStr(topMarket));
		request.setAttribute("fatherName",EncodingTool.encodeStr(fatherName));
		request.setAttribute("storeRemark",EncodingTool.encodeStr(storeRemark));
		request.setAttribute("storeId",args.getStoreId());
		request.setAttribute("storeName",EncodingTool.encodeStr(storeName));
		request.setAttribute("fatherType",fatherType);
	    //业务参数
	    LeasingContract lc = new LeasingContract();
	    String contractNum = args.getContractNum();
	    String storeId = args.getStoreId();
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    businessJson.put("storeId", storeId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1011");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::payDeposit::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::payDeposit::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::payDeposit::return code::" + returnCode);
		logger.info("wape-web::payDeposit::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {	
				JSONObject jsonobj = resultJson.getJSONObject("result");
				JSONObject leansingobj = jsonobj.getJSONObject("leasingContract");
				LeasingContract leasing = JSON.toJavaObject(leansingobj, LeasingContract.class);
				request.setAttribute("leasing", leasing);
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21204&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/rent-pay.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/wp/rent-pay.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::payDeposit::to MMZS21209 error::" + e.getMessage());
			}
			
		}
	}
	
	/**
	 * 查询商铺本月租金缴费情况,商铺维度
	 * @param args
	 * @param response
	 */
	private void collectRentalFromStore(ArgsPojo args, HttpServletResponse response, HttpServletRequest request, 
			HttpSession httpSession ){
		//基础数据
		ReturnPojo rp = new ReturnPojo();
		JSONObject json = new JSONObject();
		UserList user = (UserList) httpSession.getAttribute("user");
		String token=(String) httpSession.getAttribute("token");
		String atUserId=(String) httpSession.getAttribute("atUserId");
		//传递参数
		String openId = args.getOpenId();
		String isWX = args.getIsWX();
		request.setAttribute("openId", openId);
		request.setAttribute("isWX", isWX);
		//公参
		String timestamp = Utils.getCurrTimeMillions();
	    String nonce = Utils.getNonce();
		String sign = "";
		try {
			sign = TokenUtils.getSign(token, timestamp, nonce);
		} catch (NoSuchAlgorithmException e3) {
			logger.error("wape-web::collectRentalFromStore::sign make error::" + e3.getMessage());
		}
		String ipaddr = "";
		try {
			ipaddr = Utils.getIpAddress(request);
		} catch (IOException e2) {
			logger.error("wape-web::collectRentalFromStore::ip not get::" + e2.getMessage());
		}
	    String device = "wx";
	    String mac = "00-00-00-00-000";
	    String editUserId = atUserId;
	    String editTime = timestamp;
	    String realName = EncodingTool.encodeStr(user.getRealName());
	    String companyId = user.getCompanyId();
	    String companyName = EncodingTool.encodeStr(user.getCompanyName());
	    String departmentId = user.getDepartmentId();
	    String departmentName = EncodingTool.encodeStr(user.getDepartmentName());
	    //业务参数
	    JSONObject businessJson = new JSONObject();
	    businessJson.put("atUserId", atUserId);
	    String business = businessJson.toString();
		Map<String, String> params = new HashMap<String, String>();
		params.put("serviceCode", "MK1004");
		params.put("sign", sign);
		params.put("timestamp", timestamp);
		params.put("nonce", nonce);
		params.put("editUserId", editUserId);
		params.put("editTime", editTime);
		params.put("ipaddr", ipaddr);
		params.put("device", device);
		params.put("mac", mac);
		params.put("realName", realName);
		params.put("companyId", companyId);
		params.put("companyName", companyName);
		params.put("departmentId", departmentId);
		params.put("departmentName", departmentName);
		params.put("business", business);
		logger.info("wape-web::collectRentalFromStore::business is :" + business);
		String resultString = sendhttp(marketPath, params);
		logger.info("wape-web::collectRentalFromStore::return::" + resultString);
		JSONObject resultJson=JSON.parseObject(resultString);
		String returnCode = resultJson.getString("returnCode");
		String returnMsg = resultJson.getString("returnMsg");
		logger.info("wape-web::collectRentalFromStore::return code::" + returnCode);
		logger.info("wape-web::collectRentalFromStore::return msg::" + returnMsg);
		request.setAttribute("returnCode", returnCode);
		request.setAttribute("returnMsg", returnMsg);
		if("200".equals(returnCode)){
			try {
				//去重遍历，将二级区域分类
				JSONObject resultObj = resultJson.getJSONObject("result");
				List<MarketStore> markets = new ArrayList<MarketStore>();
				Map<String, MarketStore> mkMap = new HashMap<String, MarketStore>();
				JSONArray mks = resultObj.getJSONArray("marketStore");
				for(int i = 0, isize = mks.size(); i < isize; i++){
					MarketStore ms =  JSON.toJavaObject(mks.getJSONObject(i), MarketStore.class);
					mkMap.put(ms.getFatherId(), ms);
				}
				Iterator it = mkMap.keySet().iterator();  
				while (it.hasNext()) {  
					String key = it.next().toString();  
					markets.add(mkMap.get(key));  
				}
				request.setAttribute("markets", markets);
//				List<MarketStore> stores = JSON.toJavaObject(mks, List.class);
				List<MarketStore> stores = new ArrayList<MarketStore>();
				
				JSONArray cms = resultObj.getJSONArray("chargesManagement");
//				List<LeasingContract> leasing = JSON.toJavaObject(lcs, List.class);
				ChargesManagement cm = new ChargesManagement();
				for(int j = 0, jsize = mks.size();j < jsize; j++){
					MarketStore ms = JSON.toJavaObject(mks.getJSONObject(j), MarketStore.class);
					for(int k = 0, ksize = cms.size(); k < ksize; k++){
						cm = JSON.toJavaObject(cms.getJSONObject(k), ChargesManagement.class);
						if(ms.getStoreId().equals(cm.getSonStoreId())){
							ms.setContractNum(cm.getChargesKey());
							ms.setDeposit(cm.getPayment());
							ms.setChargesDay(cm.getChargesDay());
							break;
						}
					}
					stores.add(ms);
				}
				
				request.setAttribute("deposit", stores);
				//end
				
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21204&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectRentalFromStore::to MMZS21204 error::" + e.getMessage());
			}
		}else{
			try {
//				topMarket = java.net.URLEncoder.encode(topMarket.toString(),"utf-8"); 
//				String url = "centerService?serviceCode=MMZS21209&storeId=" + storeId + "&topMarket=" +
//						topMarket + "&fatherRemark=" + fatherRemark + "&fatherTotalArea=" + fatherTotalArea;
//				response.sendRedirect(url);
//				request.getRequestDispatcher("/api/core/centerService?serviceCode=MMZS21209&storeId=" + storeId).forward(request, response);
				request.getRequestDispatcher("/3g/platform/shop-rent/yp/deposit-collect.jsp").forward(request, response);
				return;
			} catch (Exception e) {
				logger.info("wape-web::collectRentalFromStore::to MMZS21209 error::" + e.getMessage());
			}
		}
	}
}
